From 3992c57c8bc1297c8ba7405ac74231e253b679ef Mon Sep 17 00:00:00 2001 From: typicode Date: Sun, 21 Mar 2021 03:40:42 +0100 Subject: [PATCH] feat(cli): set command --- src/bin.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/bin.ts b/src/bin.ts index 918df18b1..4bba96687 100644 --- a/src/bin.ts +++ b/src/bin.ts @@ -5,7 +5,7 @@ import { PackageJson } from 'type-fest' import { init } from './commands/init' import { install } from './commands/install' -import { add } from './commands/set_add' +import { add, set } from './commands/set_add' import { uninstall } from './commands/uninstall' function readPkg(): PackageJson { @@ -37,6 +37,10 @@ Examples husky install husky install .config/husky + husky set .husky/pre-commit + husky set .husky/pre-commit "npm test" + husky set .config/husky/pre-commit "npm test" + husky add .husky/pre-commit husky add .husky/pre-commit "npm test" husky add .config/husky/pre-commit "npm test" @@ -63,6 +67,14 @@ switch (cmd) { uninstall() break } + case 'set': { + if (args.length === 0 || args.length > 2) { + help() + process.exit(2) + } + set(args[0], args[1]) + break + } case 'add': { if (args.length === 0 || args.length > 2) { help()