Skip to content

Commit

Permalink
feat: add option on run to provide a custom folder path holding the .…
Browse files Browse the repository at this point in the history
…mookme.json file
  • Loading branch information
LMaxence committed May 7, 2023
1 parent 3be637d commit c7c03f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/docs/references/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Starting git reference used to evaluate hooks to run. If set, `to` has to be set

Ending git reference used to evaluate hooks to run. If set, `from` has to be set as well, otherwise this option is ignored.

- `--config-root` (optional)

The path of the folder where the mookme configuration file (`.mookme.json`) is stored

## `mookme inspect`

Manually test wich packages are discovered and assess if your hooks are properly configured.
Expand Down
3 changes: 2 additions & 1 deletion packages/mookme/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export function addRun(program: commander.Command): void {
.option('--from <from>', 'Starting git reference used to evaluate hooks to run', '')
.option('--to <to>', 'Ending git reference used to evaluate hooks to run', '')
.option('--args <args>', 'The arguments being passed to the hooks', '')
.option('--config-root <configRoot>', 'The path of the folder where the mookme configuration file is stored', '')
.action(async (opts: RunOptions) => {
debug('Running run command with options', opts);
const git = new GitToolkit();

// Load the different config files
const config = new Config(git.rootDir);
const config = new Config(opts.configRoot || git.rootDir);

// Initialize the UI
const ui = new MookmeUI(false, config.noClearRenderer ? new NoClearRenderer() : new FancyRenderer());
Expand Down
4 changes: 4 additions & 0 deletions packages/mookme/src/runner/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export interface RunOptions {
* A boolean parameter to detect if the whole hook suite should be ran, regardless of the VCS state
*/
to: string;
/**
* The path of the folder where the mookme configuration file is stored
*/
configRoot: string;
}

/**
Expand Down

0 comments on commit c7c03f2

Please sign in to comment.