Comparing version 0.3.0 to 0.3.1
@@ -14,3 +14,3 @@ declare type ID = string | number | symbol; | ||
}; | ||
export declare const cmds: <TParams extends Config>(params: TParams, args: string[]) => (cmds: Cmds<TParams>, noMatch?: (() => void) | undefined) => void | Promise<void>; | ||
export declare const cmds: <TParams extends Config>(params: TParams, args: string[]) => (cmds: Cmds<TParams>, noMatch?: ((params: TParams, args: string[]) => void) | undefined) => void | Promise<void>; | ||
export declare const Value: ParamFn<string, []>; | ||
@@ -17,0 +17,0 @@ export declare const Flag: ParamFn<true | number, []>; |
@@ -14,3 +14,3 @@ "use strict"; | ||
} | ||
noMatch === null || noMatch === void 0 ? void 0 : noMatch(); | ||
noMatch === null || noMatch === void 0 ? void 0 : noMatch(params, args); | ||
}; | ||
@@ -17,0 +17,0 @@ exports.cmds = cmds; |
{ | ||
"name": "otps", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"packageManager": "pnpm@8.6.2", | ||
@@ -5,0 +5,0 @@ "type": "commonjs", |
@@ -89,4 +89,6 @@ # otps | ||
For easier managment of sub-commands, use `cmds`: | ||
For easier managment of sub-commands, use `cmds`. | ||
Create a `cmdsapp.js` file: | ||
```js | ||
@@ -96,3 +98,3 @@ import { parse, Value, cmds } from 'otps' | ||
const [params, args] = parse(process.argv.slice(2), { | ||
build: { | ||
build: { | ||
format: Value(), | ||
@@ -111,4 +113,8 @@ production: { | ||
const version = params.version | ||
// ... | ||
console.log(`production build: ${format}, name: app@${version}`) | ||
console.log(args) | ||
} | ||
}, (params, args) => { | ||
console.log(`development build: ${format}, name: app@dev`, args) | ||
console.log(args) | ||
}) | ||
@@ -119,2 +125,15 @@ } | ||
Then run the program: | ||
```sh | ||
node cmdsapp.js build --format esm production --version 1.0 src/index.ts | ||
# => production build: esm, name: app@1.0 | ||
# ['src/index.ts'] | ||
node cmdsapp.js build --format esm src/index.ts | ||
# => production build: esm, name: app@dev | ||
# ['src/index.ts'] | ||
``` | ||
## Parameters | ||
@@ -121,0 +140,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12282
203