"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/cli/commands/process-command-args.ts" (20 Feb 2024, 575 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { Options } from '../../lib/types';
    2 
    3 export function processCommandArgs<CommandOptions>(
    4   ...args
    5 ): { paths: string[]; options: Options & CommandOptions } {
    6   let options = ({} as any) as Options & CommandOptions;
    7 
    8   if (typeof args[args.length - 1] === 'object') {
    9     options = (args.pop() as any) as Options & CommandOptions;
   10   }
   11   args = args.filter(Boolean);
   12 
   13   // For repository scanning, populate with default path (cwd) if no path given
   14   if (args.length === 0 && !options.docker) {
   15     args.unshift(process.cwd());
   16   }
   17 
   18   return { options, paths: args };
   19 }