* WIP: Double-clicking on .kcl file on Windows redirects to the home page if the app is already open Fixes #5412 * Add deep link test case for linux * Add mac tests * Lint and win tests * Fix e2e tests * Logs everywhere * windows weird? yup * More logzzz maybe it's not windows * Remove :/// replacement. Add catch log * Fix and clean up * FIx lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * More lint * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Clean up tests further --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
30 lines
723 B
TypeScript
30 lines
723 B
TypeScript
import minimist from 'minimist'
|
|
import yargs from 'yargs'
|
|
import { hideBin } from 'yargs/helpers'
|
|
|
|
export const argvFromYargs = yargs(hideBin(process.argv))
|
|
.option('telemetry', {
|
|
alias: 't',
|
|
type: 'boolean',
|
|
description: 'Writes startup telemetry to file on disk.',
|
|
})
|
|
.parse()
|
|
|
|
// TODO: find a better way to merge minimist and yargs parsers.
|
|
|
|
export function parseCLIArgs(argv: string[]): minimist.ParsedArgs {
|
|
return minimist(argv, {
|
|
// Treat all double-hyphenated arguments without equal signs as boolean
|
|
boolean: true,
|
|
})
|
|
}
|
|
|
|
export function getPathOrUrlFromArgs(
|
|
args: minimist.ParsedArgs
|
|
): string | undefined {
|
|
if (args._.length > 1) {
|
|
return args._[1]
|
|
}
|
|
return undefined
|
|
}
|