Skip to content

Commit

Permalink
fix(cli): flags in additionalArgs consumed by vr
Browse files Browse the repository at this point in the history
Fixes #26
  • Loading branch information
umbopepato committed May 24, 2020
1 parent 8251db4 commit 9510a92
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
8 changes: 1 addition & 7 deletions src/cli/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import { ConfigData } from "../../load_config.ts";
import { exportScripts } from "../../export_scripts.ts";

export class ExportCommand extends BaseCommand {
private helpCommand = new HelpCommand(this);

constructor(private configData: ConfigData | null) {
super();
this.description("Export one or more scripts as executable files")
.type("scriptid", new ScriptIdType(this.configData))
.arguments("[scripts...:string:scriptid]")
.arguments("[scripts...:scriptid]")
.option(
"-o, --out-dir [dir:string]",
"The folder where the scripts will be exported",
Expand All @@ -19,8 +17,4 @@ export class ExportCommand extends BaseCommand {
await exportScripts(this.configData, scripts, options.outDir);
});
}

getHelpCommand(): HelpCommand {
return this.helpCommand;
}
}
11 changes: 3 additions & 8 deletions src/cli/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,14 @@ import { ConfigData } from "../../load_config.ts";
import { runScript } from "../../run_script.ts";

export class RunCommand extends BaseCommand {
private helpCommand = new HelpCommand(this);

constructor(private configData: ConfigData | null) {
super();
this.description("Run a script")
.type("scriptid", new ScriptIdType(this.configData))
.arguments("<script:string:scriptid> [additionalArgs...]")
.action(async (options, script: string, additionalArgs: string[]) => {
.arguments("<script:scriptid> [additionalArgs...]")
.useRawArgs()
.action(async (options, script: string, ...additionalArgs: string[]) => {
await runScript(this.configData, script, additionalArgs);
});
}

getHelpCommand(): HelpCommand {
return this.helpCommand;
}
}
12 changes: 7 additions & 5 deletions src/cli/commands/vr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import { ExportCommand } from "./export.ts";
import { runScript } from "../../run_script.ts";

export class VrCommand extends Command {
protected name = "vr"; // TODO replace with the actual cmd name when it'll be possible
protected path: string = this.name;
// protected name = "vr"; // TODO replace with the actual cmd name https://github.com/denoland/deno/issues/5725
// protected path: string = this.name;

constructor(private configData: ConfigData | null) {
super();
this.version(version)
this.name("vr")
.version(version)
.description(
"🦖 Velociraptor\nAn npm-style script runner for Deno\n\nDocs: https://github.com/umbopepato/velociraptor",
)
Expand All @@ -25,8 +26,9 @@ export class VrCommand extends Command {
"Log verbosity. One of: DEBUG, INFO, WARNING, ERROR, CRITICAL",
)
.type("scriptid", new ScriptIdType(this.configData))
.arguments("[script:string:scriptid] [additionalArgs...]")
.action(async (options, script: string, additionalArgs: string[]) => {
.arguments("[script:scriptid] [additionalArgs...]")
.useRawArgs()
.action(async (options, script: string, ...additionalArgs: string[]) => {
await runScript(this.configData, script, additionalArgs);
})
.command("run", new RunCommand(this.configData))
Expand Down

0 comments on commit 9510a92

Please sign in to comment.