-
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.
- Loading branch information
1 parent
53a6cf4
commit 561a4fd
Showing
2 changed files
with
30 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { BaseCommand } from "../../../deps.ts"; | ||
import { ConfigData } from "../../load_config.ts"; | ||
import { runScript } from "../../run_script.ts"; | ||
import { HookType } from "../types/hook_type.ts"; | ||
import {installGitHooks} from '../../git_hooks.ts'; | ||
|
||
export class HooksCommand extends BaseCommand { | ||
constructor(private configData: ConfigData | null) { | ||
super(); | ||
this.description("Git hooks") | ||
.type("hook", new HookType()) | ||
.command("run <hook:hook> [args...]") | ||
.description("Run a git hook") | ||
.useRawArgs() | ||
.action(async (_, hook: string, ...args: string[]) => { | ||
await runHook(this.configData, hook, args); | ||
}) | ||
.command("install") | ||
.description("Install git hooks") | ||
.action(() => installGitHooks(this.configData.cwd)); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { StringType } from "../../../deps.ts"; | ||
import { hooks } from "../../git_hooks.ts"; | ||
|
||
export class HookType extends StringType { | ||
complete(): string[] { | ||
return hooks; | ||
} | ||
} |