Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP #123

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

WIP #123

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/cli-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ function getPlatform(parsed: minimist.ParsedArgs) {
*
* @param argv The parameters to use (default: reads from `process.argv`)
*/
export function parse(argv?: string[]): CliParameters {
export function parse(
// use the default process args if nothing was passed in
argv = argv || process.argv.slice(2);

argv: string[] = process.argv.slice(2)
): CliParameters {
// parse the arguments with minimist
const parsed = minimist(argv);

// grab what we need
const platform = getPlatform(parsed);
const useClipboard = !parsed['f'];
const filename = (parsed['f'] as string) || tempfile('.png');
const device = parsed['d'] as string;
const useClipboard = !parsed.f;
const filename = (parsed.f as string) || tempfile({ extension: 'png' });
const device = parsed.d as string;

return { platform, filename, device, useClipboard };
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "commonjs",
"module": "Node16",
"moduleResolution": "node16",
"declaration": true,
"noImplicitAny": false,
Expand Down