3.8.70 • Published 11 months ago

@dramaorg/esse-eius v3.8.70

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@dramaorg/esse-eius

Small library for parsing command line arguments for git style tools.

The strength is the type safety and extensible architecture it enables.

How to install

npm install @dramaorg/esse-eius

Example

Helper classes

interface IgnoreAction {
  act(): void;
}
class DownloadIgnore implement IgnoreAction {
  constructor(private language: string) { }
  act() { ... }
}
class DoNothing implement IgnoreAction {
  act() { }
}

class Repo implements Command {
  constructor(
    private name: string, 
    private flags: { 
      private: boolean, 
      ignore: IgnoreAction 
    }) { }
  execute() { 
    ...
    this.flags.ignore.act();
    ...
  }
}

Configuring the parser

let argParser = new ArgumentParser();
argParser.push("repo", {
  desc: "Setup a new repository",
  arg: "name",
  construct: (arg, params) => new Repo(arg, params),
  flags: {
    private: {
      short: "p",
      desc: "Private repository",
      overrideValue: true,
      defaultValue: false,
    },
    ignore: {
      short: "i",
      desc: "Fetch standard .gitignore",
      arg: "language",
      overrideValue: (s) => new DownloadIgnore(s),
      defaultValue: new DoNothing(),
    },
  },
});

Template for calling the parser

if (process.argv[0].endsWith("node.exe")) process.argv.splice(0, 1);
process.argv.splice(0, 1);
if (process.argv[0] === "help") {
  console.log(argParser.helpString(process.argv[1]));
} else {
  let cmds = argParser.parse(process.argv);
  cmds.forEach((cmd) => cmd.execute());
}

How to use

For a more thorough tutorial see my blog post on Medium: https://medium.com/@thedrlambda/cli-architecture-in-nodejs-852e95773403

How to test

npm test

How to contribute

Make sure the tests are passing and that there are only dev dependencies, then just send me a pull request.

rmdirmatchesinferencecall-boundfindeventDispatcherpolyfillESfssymbolxmla11ykey valueagentcjknamesprotocol-buffersinstrumentationfront-endredactRxJSpostcsscommanduuiduninstallArray.prototype.flatvestsymlinksprivate dataapolloaccessorfunction.lengthjshintReactiveXassertserrorajaxECMAScript 6sameValueZeroclass-validatorUint8Arraynegative zeroObject.fromEntriesjasmineES2021ajviteratorlintglobperformanthasOwnPropertyJSON-Schemacolorsbindtslibes8bufferendersnsebsWebSocketsCSSfast-clonedeepclonefnmatcheslint-pluginpopmotionpackagesettercoveragebabel@@toStringTagwaapigesturesjsonunicodetypeerrorHyBibrowserdifftappackage.jsonwebbinariesmulti-packagesyntaxerrorECMAScript 2021zxdeterministic__proto__walktrimEndentriesmakefetchpropregular expressionsString.prototype.matchAllec2definePropertywidthttyconstgraphqlprivatecryptocharactersform-validationreact posereact-hook-formObservablestranspilerremoveobjectfantasy-landjapanesetestingeveryflates6dataparentsexecfileRxstartercss-in-jsconsolemkdirpowncachestablekinesises20156to5ArrayserializeInt8ArrayharmonyeslintplugingetPrototypeOfmodulesnativeshimes7settingsdelete$.extendcharacteratomterminalMapnodeacornmetadata_.extendwritableObservableastpropertyobj.gitignorecallbindoptimistphonei18npackagesArray.prototype.findLastIndexelectronfunctionJSONtoolkitAsyncIteratorestreecore-jsbddsqscallboundregexpformselasticacheflatMapES8rssargslistenerspromisees-shimsprotoponyfillpushmapreducePromiseimmernamelook-upmatchArrayBufferspawnflageffect-tsbyteeventsindicatorcollection.es6formattingregulardayjsslotconfigUint32Arrayforkrfc4122asciilocalclassnamermextraslicecurriedstylingroutingdirectorydefinetc39helpertypescriptvaluetermdebuggerspinnerlibphonenumberquoteforEachreduceprocessexpressionreducerarrayredirecttransformmanagerrouteromitvalidReflect.getPrototypeOftypedarraysenvironmentmockdescriptorssetPrototypeOfeslintconfigequalityfast-copytypeObject.ispicomatchdebugio-tscall-bindtddasyncawsbyteOffsettrimRegExp#flagstoobjectairbnbes-shim APITypedArrayquerystringreuseinspecteventEmittervaluesshellschemachildcommanderchromiumsimpledbconsumetypeofprunefastifyswfignorespecrm -frhooksperformancecallbackloggingspeedreact animationcircularpropertiesparentasserthelperstrimRightviewflattenES2023make dirsource mapcoerciblecliidlemobiletypedarrayfromworkerbabel-corecensorStreamsaccessibilityavareadarraysformjQuerycommand-linetoStringTagfast-deep-copyArray.prototype.containsdeep-copyoptimizerfiglettypedfulljsdomcalltoolsstreamwgettesterservice0fileapiWeakMapistanbuldeepsetImmediatereadablestreammomentFloat32Arraydragvpcdependency managermanipulationhtmlfilterargumentES6prototypeprefixfile cachewarningECMAScript 2016robustfull-widthxhrSetreduxUnderscoreinternal slotreal-timelastkeystyleguidetypesArray.prototype.flatMapcodesmatchAllstyletypesafegetOwnPropertyDescriptoroffsetiteratecopycloudsearchbundlingweakmapresolvestringifyserializationfindLastfunctionalroute53espreeloggermoveruntimetypaniondescriptor.envtextrequirepurejsdiffgitignorelanguageieFunction.prototype.namefindupes2017Object.entriesarttransportutilECMAScript 2015toSortedfind-upframerWeakSetreact-hooksletqueueupstringmonoreporandomramdanumberkoreanRegExp.prototype.flagscolourCSSStyleDeclarationdeepcopytapebannerwalkingspringcsspoint-freepluginexecutecolumnECMAScript 2019concatMapparserdependencieseslintwriteES3ES2019lengthposestylesminimalemojisimple cacherecursiveesserveriamtraversequeueMicrotaskthreetelephoneappes-abstractYAMLrangeerrorshebangloadbalancingrulesObject.assignefficientregular-expressionenumerableBigUint64Arrayhigher-orderspinnerscloneimportincludesfastclonedotenvcode pointstyped arrayURLidReactiveExtensionsequaldirutilsnodejsESnextidentifiersregular expressionsuperstructdropmergedeep-clonesyntaxsideTypeScriptnegativeObjectworkspace:*escapeES7back-endchromejson cacheES2020utilitydescriptioncloudtrailansitacitinstallersesrgbshrinkwrapES5toReversedreact-testing-librarysinatrafastcopyUint8ClampedArray-0sorthashassignpreprocessoryuppatchurltsreworkshamObject.keysRFC-6455visualreactfullwidthgetintrinsicStreamschemezeromapkeysprogressimportexportjavascriptinputtostringtagclassesautoprefixersuperagent3drm -rfdynamodbarktypejsfolderURLSearchParamschinesebundlerproxyinstalles5modulecomputed-typesrapidnopesearchhandlerendpointclient[[Prototype]]whichwhatwgstyled-componentshas-ownpathsortedlocationstreamscompilercurlECMAScript 2018ECMAScript 5pyyamlgetsafe
3.8.70

11 months ago

3.8.69

11 months ago

3.8.68

11 months ago

3.8.67

11 months ago

3.7.67

11 months ago

3.7.66

11 months ago

3.7.65

12 months ago

3.7.64

12 months ago

3.7.63

12 months ago

3.7.62

12 months ago

3.7.61

12 months ago

3.7.60

12 months ago

3.7.59

12 months ago

3.6.59

12 months ago

3.6.58

12 months ago

3.6.57

12 months ago

3.6.56

12 months ago

2.6.56

12 months ago

2.6.55

12 months ago

2.6.54

12 months ago

2.5.54

12 months ago

2.5.53

12 months ago

2.5.52

12 months ago

2.5.51

12 months ago

2.4.51

12 months ago

2.4.50

12 months ago

2.4.49

1 year ago

2.4.48

1 year ago

2.4.47

1 year ago

2.4.46

1 year ago

2.4.45

1 year ago

2.3.45

1 year ago

2.3.44

1 year ago

2.3.43

1 year ago

2.3.42

1 year ago

2.3.41

1 year ago

2.3.40

1 year ago

2.3.39

1 year ago

2.2.39

1 year ago

2.2.38

1 year ago

2.2.37

1 year ago

2.2.36

1 year ago

2.2.35

1 year ago

2.2.34

1 year ago

2.2.33

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.2.30

1 year ago

2.2.29

1 year ago

2.2.28

1 year ago

2.2.27

1 year ago

2.2.26

1 year ago

2.2.25

1 year ago

2.2.24

1 year ago

2.2.23

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.1.21

1 year ago

2.1.20

1 year ago

2.1.19

1 year ago

2.1.18

1 year ago

1.1.18

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago