Skip to content
Myr

split.js

This file

Path

examples/split.js

16 lines · 474 bytes · JavaScript

Last changed by

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

History of this file

Take it

The walk stopped after 200 commits: lines older than 471ec40 point at it.

Switching to esm-only (#2464)John Geebefore adoptionf4bd470

line 1why, one step back
1import { program } from 'commander';

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 2–4why, one step back
2
3// This is used as an example in the README for the Quick Start.4

Update README and examples for allowExcessArguments change (#2266)John Geebefore adoption2c9051a

line 5why, one step back
5program.option('--first').option('-s, --separator <char>').argument('<string>');

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

lines 6–13why, one step back
6
7program.parse();89const options = program.opts();10const limit = options.first ? 1 : undefined;11console.log(program.args[0].split(options.separator, limit));1213// Try the following:

Merge from develop (#2482)John Geebefore adoptionb51c0ea

lines 14–15why, one step back
14// node split -s - --fits a-b-c
15// node split -s - --first a-b-c

Add copyInheritedSettings to README (#1798)John Geebefore adoption471ec40

line 16why, one step back
16// node split --separator=, a,b,c