@kosko/cli-utils
Advanced tools
Comparing version 0.0.0-20240324064444 to 0.0.0-20240324074257
@@ -1,3 +0,74 @@ | ||
export { type GlobalArguments, globalOptions, parse } from "./command"; | ||
export { CLIError, handleError } from "./error"; | ||
export { setupLogger } from "./logger"; | ||
import { Argv } from 'yargs'; | ||
/** | ||
* @public | ||
*/ | ||
interface GlobalArguments { | ||
cwd: string; | ||
"log-level": string; | ||
silent: boolean; | ||
} | ||
/** | ||
* @public | ||
*/ | ||
declare const globalOptions: { | ||
readonly cwd: { | ||
readonly type: "string"; | ||
readonly describe: "Path of working directory"; | ||
readonly global: true; | ||
readonly default: () => string; | ||
readonly defaultDescription: "CWD"; | ||
readonly coerce: (arg: string) => string; | ||
}; | ||
readonly "log-level": { | ||
readonly type: "string"; | ||
readonly describe: "Set log level"; | ||
readonly global: true; | ||
readonly default: "info"; | ||
}; | ||
readonly silent: { | ||
readonly type: "boolean"; | ||
readonly describe: "Disable log output"; | ||
readonly global: true; | ||
readonly default: false; | ||
}; | ||
}; | ||
/** | ||
* @public | ||
*/ | ||
declare function parse(input: Argv, argv: readonly string[]): Promise<void>; | ||
/** | ||
* @public | ||
*/ | ||
declare class CLIError extends Error { | ||
readonly output?: string; | ||
readonly code?: number; | ||
constructor(msg: string, { output, code }?: { | ||
output?: string; | ||
code?: number; | ||
}); | ||
} | ||
/** | ||
* Handles CLI errors. | ||
* | ||
* @remarks | ||
* This function prints error message to logger and terminates current process | ||
* with status code specified in `err` object. | ||
* | ||
* @example | ||
* ```ts | ||
* run().catch(handleError); | ||
* ``` | ||
* | ||
* @public | ||
*/ | ||
declare function handleError(err: unknown): void; | ||
/** | ||
* @public | ||
*/ | ||
declare function setupLogger(args: Pick<GlobalArguments, "silent" | "log-level">): void; | ||
export { CLIError, type GlobalArguments, globalOptions, handleError, parse, setupLogger }; | ||
//# sourceMappingURL=index.d.ts.map |
{ | ||
"name": "@kosko/cli-utils", | ||
"version": "0.0.0-20240324064444", | ||
"version": "0.0.0-20240324074257", | ||
"description": "CLI utilities used in Kosko.", | ||
@@ -46,3 +46,3 @@ "homepage": "https://kosko.dev", | ||
"dependencies": { | ||
"@kosko/log": "^0.0.0-20240324064444" | ||
"@kosko/log": "^0.0.0-20240324074257" | ||
}, | ||
@@ -52,4 +52,4 @@ "devDependencies": { | ||
"yargs": "^17.5.1", | ||
"@kosko/build-scripts": "^0.0.0", | ||
"@kosko/jest-preset": "^0.0.0" | ||
"@kosko/jest-preset": "^0.0.0", | ||
"@kosko/build-scripts": "^0.0.0" | ||
}, | ||
@@ -56,0 +56,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
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
21648
10
193