1.0.0 • Published 12 days ago

@wemnyelezxnpm/odio-sapiente-totam v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 days ago

Clipanion

Type-safe CLI library with no runtime dependencies

npm version Licence Yarn

Installation

yarn add @wemnyelezxnpm/odio-sapiente-totam

Why

  • Clipanion supports advanced typing mechanisms
  • Clipanion supports nested commands (yarn workspaces list)
  • Clipanion supports transparent option proxying without -- (for example yarn dlx eslint --fix)
  • Clipanion supports all option types you could think of (including negations, batches, ...)
  • Clipanion offers a Typanion integration for increased validation capabilities
  • Clipanion generates an optimized state machine out of your commands
  • Clipanion generates good-looking help pages out of the box
  • Clipanion offers common optional command entries out-of-the-box (e.g. version command, help command)

Clipanion is used in Yarn with great success.

Documentation

Check the website for our documentation: mael.dev/@wemnyelezxnpm/odio-sapiente-totam.

Migration

You can use @wemnyelezxnpm/odio-sapiente-totam-v3-codemod to migrate a Clipanion v2 codebase to v3.

Overview

Commands are declared by extending from the Command abstract base class, and more specifically by implementing its execute method which will then be called by Clipanion. Whatever exit code it returns will then be set as the exit code for the process:

class SuccessCommand extends Command {
    async execute() {
        return 0;
    }
}

Commands can also be exposed via one or many arbitrary paths using the paths static property:

class FooCommand extends Command {
    static paths = [[`foo`]];
    async execute() {
        this.context.stdout.write(`Foo\n`);
    }
}

class BarCommand extends Command {
    static paths = [[`bar`]];
    async execute() {
        this.context.stdout.write(`Bar\n`);
    }
}

Options are defined as regular class properties, annotated by the helpers provided in the Option namespace. If you use TypeScript, all property types will then be properly inferred with no extra work required:

class HelloCommand extends Command {
    // Positional option
    name = Option.String();

    async execute() {
        this.context.stdout.write(`Hello ${this.name}!\n`);
    }
}

Option arguments can be validated and coerced using the Typanion library:

class AddCommand extends Command {
    a = Option.String({required: true, validator: t.isNumber()});
    b = Option.String({required: true, validator: t.isNumber()});

    async execute() {
        this.context.stdout.write(`${this.a + this.b}\n`);
    }
}

License (MIT)

Copyright © 2019 Mael Nison

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

configcommandsymbolStreamlockfileappfigletjsdifftranspilerwalkingfsnopeStreamsprotocol-buffersmkdirurlsharmonyttyregexpfpMicrosoftvaluebluebirdES2023linuxES2018setPrototypeOfrfc4122Int8Arrayoptiondeep-copyserializetoolkittypesassertsxdgArray.prototype.flatMapmacosurlajaxsharedutil.inspectqueuepoint-freecmdsetImmediatepropstylebrowserslistsyntaxerrorCSSdeterministicflatECMAScript 2021task$.extendprettyfastifyfindupformses2016redux-toolkitInt32Arraydescriptionbddrm -frfunctionalviewIteratorshimthroatcode pointslimitfullwidthfunctionansireadString.prototype.matchAllRxdefineoffsetless compilershrinkwrapsuperagentcoerciblenegative zerovariablesboundstylingvalidateweakmapdataViewenvironmentmake dirpersistentYAMLhelperszeroes2017wordwrapobjectvalidtslibhashsigtermpatchobjclassnamesettingscensorawaites-shimswarning6to5hooksgroupBySymbol.toStringTagprototypeInt16ArraychannelArrayregular expressionglobperformanceserializationminimalHyBiarrayssafewatcheres-shim APIArray.prototype.includeshasOwnreactpackagesfindLastIndexsomeduplex.enves2018framerprocessexit-codebufferseast-asian-widtharraysameValueZerooncefolderprotoshamless cssuser-streamsparsersigintes7waapiio-tscsstypesafestringwritecloneargumentsFloat32ArrayimmutablecallbindsorteddotenvextensionspecinstallparentsmonorepoyupenvopenssyntaxpushcurriedstringifierwalktakeTypedArraycharactergradients css3dataArrayBufferES8nativereusexssArrayBuffer#slicevalidationreact-hooksguidaststartlook-upsearchhasFunction.prototype.nameinstallerpolyfillconcurrencySetdescriptorsECMAScript 2020fixed-widthhardlinksexecpackagestyleguideprogresstesterrgbprivatecoreFloat64ArrayintrinsictextObject.valuestraversecjkelectronstylesheetrobustcolumnsmetadatareduxmodulestoobjectless.jsexitprivate datacollection.es6regularpostcssjson-schema-validatoriterateArray.prototype.flattendebuggdprkeyObject.definePropertyes2015ObjectwidthtrimEndweaksetArray.prototype.findLastIndexwhatwgnegativemochaclass-validatortypedflatMapcall-bindpopmotionquerymomentredactloggingform-validationdeletewgetchaienumerableES5stringifypromiseslimitedbundlerphonecacheresolveforEacheslintpluginfull-widtheventstacitpluginES2019bootstrap cssECMAScript 7Array.prototype.filterCSSStyleDeclarationtrimcomputed-typesjwtargswhichmixinslessfastcloneargparsexdg-openfile systempathchromiumpromiseformObject.fromEntriesflagtoSortedsignalhookformstablelastponyfilljoixtermfseventsfilterbreaktrimRightstylesinvariantdompackage.jsonJSON-Schemaasserttimefast-copyruntimecollectionUnderscoreutilsUint16ArraynodejsgetterdroputiltaptostringtagoutputaccessorWeakMapstreameslintconfigcolourbusyclassnameskeysnpmcss nestingoptimistirqasync3domitcopyWebSocketjQueryworkerbytestreamsspawnRFC-6455pnpm9deep-cloneschemedirwebslottypewatchingclientes8symlinkscompareES2015performantlinewrapdependency manageriepropertiesrm -rfless mixinsserializerpropertyECMAScript 6fulleventDispatcherjapaneseframeworkefficientairbnbawesomesaucecorsquotetsassertiontestpicomatchentriesObject.entries0loadingpackage managerautoprefixershellmiddlewaretapetouchposelazydatecallboundsliceeditorexpressvestaccessibilitydeepcloneformattingimportescapeAsyncIteratorES2022-0defineProperty256concatMapcss lesspositivetddES2017visualparentnested cssvarreact animationbatchcompile lesscurlTypeBoxprunepasswordmruwindowsfetch_.extendconstchilddiffReactiveXJSONutilityes5__proto__es-abstractnamesconcatmovemime-dbnodetypeofbabel-coretelephonegestureshigher-orderextracliECMAScript 5l10nremovedefaultunicodereducerUint32ArrayreadablestreamtypanionchinesePromiseES3recursivemulti-packageartuninstalljavascriptUint8ClampedArrayECMAScript 2015apolloreact-testing-librarydeepreact-hook-formeventEmitterstarterconsumeassignpipeObject.getPrototypeOfArrayBuffer.prototype.slicedependenciesstatelessmoduleschemalaunchECMAScript 2017extendutilitiesmergeqslengthnamecharacterswritableratelimitjson-schemauuidexecutableprefixES6URLSearchParamsArray.prototype.flatESReflect.getPrototypeOftypeerrorjsfast-deep-copytypescriptWebSocketsidinputencryptionidleECMAScript 2023RxJSapijsxhttpsemojibcrypta11ywatchtrimLeftxhrdatastructurebyteOffsetauthESnextarraybufferdayjsasciiprotobufES2020languageterminalbufferbrowserlistloggerspinnerbannerES7Observablerapidfinditeratorjson-schema-validationinferencefastcallspeedinterruptscall-boundcryptsanitizationgroupconsolermendereveryrequestiterationgetequalregexkoreanbindargumentgetOwnPropertyDescriptorisConcatSpreadablecolorsObservablescompilercheckES2021setimmerpreprocessoreslint-pluginlistenerstoStringTagRegExp#flagsArray.prototype.containsECMAScript 2022bootstrap lessgetPrototypeOffast-clonechromedom-testing-librarywatchFilegenericsgraphqlvariables in csswordbreakECMAScript 2018mimedataviewrangeerrorspinnersbabelequalityspringoptimizerqueueMicrotaskECMAScript 3filecss variableesthreetoolstoArrayexeES2016zodtyped arraylinkconfigurablecore-jssetterramdafastcopyjasmineconnectcreatelogargvUint8Arrayreal-timecryptoString.prototype.trimerror-handlingcoloryamlRegExp.prototype.flagslookObject.isstatusbrowserpreserve-symlinksstyled-componentsdescriptorpostcss-plugindeepcopymatchesvalidatorsuperstructtestingmaphandlersStyleSheetmkdirpoperating-systemhttptypedarrayArray.prototype.findLastkarmaBigUint64Arraywrapflagsscheme-validationformatpurefantasy-landPushthrottle@@toStringTagflattensortfunctionsReactiveExtensionsTypeScriptopenerexpressionincludessharedarraybuffershebangsymbolscommander
1.0.0

12 days ago