-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hooks): add hooks installation checks
- Loading branch information
1 parent
66f127f
commit 98c9f43
Showing
5 changed files
with
32 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
import { Command } from "../../../deps.ts"; | ||
import { ScriptIdType } from "../script_id_type.ts"; | ||
import { ConfigData } from "../../load_config.ts"; | ||
import { exportScripts } from "../../export_scripts.ts"; | ||
import { checkGitHooks } from "../../git_hooks.ts"; | ||
import { validateConfigData } from "../../validate_config_data.ts"; | ||
|
||
export class ExportCommand extends Command { | ||
constructor(private configData: ConfigData | null) { | ||
super(); | ||
this.description("Export one or more scripts as executable files") | ||
.type("scriptid", new ScriptIdType(this.configData)) | ||
.arguments("[scripts...:scriptid]") | ||
.option( | ||
"-o, --out-dir [dir:string]", | ||
"The folder where the scripts will be exported", | ||
) | ||
.action(async (options, scripts: string[]) => { | ||
await exportScripts(this.configData, scripts, options.outDir); | ||
validateConfigData(this.configData); | ||
await checkGitHooks(this.configData as ConfigData); | ||
await exportScripts( | ||
this.configData as ConfigData, | ||
scripts, | ||
options.outDir, | ||
); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import { Command } from "../../../deps.ts"; | ||
import { ScriptIdType } from "../script_id_type.ts"; | ||
import { ConfigData } from "../../load_config.ts"; | ||
import { runScript } from "../../run_script.ts"; | ||
import { checkGitHooks } from "../../git_hooks.ts"; | ||
import { validateConfigData } from "../../validate_config_data.ts"; | ||
|
||
export class RunCommand extends Command { | ||
constructor(private configData: ConfigData | null) { | ||
super(); | ||
this.description("Run a script") | ||
.type("scriptid", new ScriptIdType(this.configData)) | ||
.arguments("<script:scriptid> [additionalArgs...]") | ||
.useRawArgs() | ||
.action(async (options, script: string, ...additionalArgs: string[]) => { | ||
if (script === "--help" || script === "-h") { | ||
console.log(this.getHelp()); | ||
return; | ||
} | ||
await runScript(this.configData, script, additionalArgs); | ||
validateConfigData(this.configData); | ||
await checkGitHooks(this.configData as ConfigData); | ||
await runScript(this.configData as ConfigData, script, additionalArgs); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters