feat: support explicit root in the cli
This commit is contained in:
parent
ce3d010901
commit
11c492e69b
|
@ -5,7 +5,9 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
<!-- ## Unreleased -->
|
||||
## Unreleased
|
||||
|
||||
- Add ability to explicitly set the root for the running command using the `--root` flag
|
||||
|
||||
## 0.6.0 - 2021-11-05
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {join, resolve} from 'path';
|
||||
import {resolve} from 'path';
|
||||
|
||||
import minimist from 'minimist';
|
||||
|
||||
|
@ -15,10 +15,8 @@ const DEFAULT_SUBCOMMANDS = {
|
|||
export function parseCliArguments(rawInputs?: string[]) {
|
||||
const inputs = minimist(rawInputs || []);
|
||||
const command = inputs._[0];
|
||||
const root =
|
||||
command === 'create' && inputs._[2]
|
||||
? join(process.cwd(), inputs._[2])
|
||||
: process.cwd();
|
||||
|
||||
const root = inputs.root || process.cwd();
|
||||
const subcommand =
|
||||
inputs._[1] || DEFAULT_SUBCOMMANDS[command as 'create' | 'version'];
|
||||
const {debug} = inputs;
|
||||
|
|
Loading…
Reference in a new issue