5.7.83 • Published 10 months ago

@taktikorg/consectetur-quod-dolor v5.7.83

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

@taktikorg/consectetur-quod-dolor Version Badge

github actions coverage License Downloads

npm badge

Parse and quote shell commands.

example

quote

var quote = require('@taktikorg/consectetur-quod-dolor/quote');
var s = quote([ 'a', 'b c d', '$f', '"g"' ]);
console.log(s);

output

a 'b c d' \$f '"g"'

parse

var parse = require('@taktikorg/consectetur-quod-dolor/parse');
var xs = parse('a "b c" \\$def \'it\\\'s great\'');
console.dir(xs);

output

[ 'a', 'b c', '\\$def', 'it\'s great' ]

parse with an environment variable

var parse = require('@taktikorg/consectetur-quod-dolor/parse');
var xs = parse('beep --boop="$PWD"', { PWD: '/home/robot' });
console.dir(xs);

output

[ 'beep', '--boop=/home/robot' ]

parse with custom escape character

var parse = require('@taktikorg/consectetur-quod-dolor/parse');
var xs = parse('beep ^--boop="$PWD"', { PWD: '/home/robot' }, { escape: '^' });
console.dir(xs);

output

[ 'beep --boop=/home/robot' ]

parsing shell operators

var parse = require('@taktikorg/consectetur-quod-dolor/parse');
var xs = parse('beep || boop > /byte');
console.dir(xs);

output:

[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]

parsing shell comment

var parse = require('@taktikorg/consectetur-quod-dolor/parse');
var xs = parse('beep > boop # > kaboom');
console.dir(xs);

output:

[ 'beep', { op: '>' }, 'boop', { comment: '> kaboom' } ]

methods

var quote = require('@taktikorg/consectetur-quod-dolor/quote');
var parse = require('@taktikorg/consectetur-quod-dolor/parse');

quote(args)

Return a quoted string for the array args suitable for using in shell commands.

parse(cmd, env={})

Return an array of arguments from the quoted string cmd.

Interpolate embedded bash-style $VARNAME and ${VARNAME} variables with the env object which like bash will replace undefined variables with "".

env is usually an object but it can also be a function to perform lookups. When env(key) returns a string, its result will be output just like env[key] would. When env(key) returns an object, it will be inserted into the result array like the operator objects.

When a bash operator is encountered, the element in the array with be an object with an "op" key set to the operator string. For example:

'beep || boop > /byte'

parses as:

[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]

install

With npm do:

npm install @taktikorg/consectetur-quod-dolor

license

MIT

Reflect.getPrototypeOfpluginxtermexpresstranspilerenvECMAScript 2020compareES2020syntaxerrorenderiteration$.extendAsyncIteratorformatfantasy-landebswriteglobalshellguidtoolsestreeprivate data.envsigtermbddxhrRxJSvalidatorTypeBoxcollection.es6equality6to5fastcopyES2021slotArray.prototype.findLastIndexReactiveExtensionsargvarraydatecolorsES2022puredayjsexecuteenvironmentshrinkwrapwafObject.keysbrowserpyyamlnopecolumnsestranspilelockfileoptimistopensslbufferscommandharmonyMapsuperstructschemees-shim APIform-validationshebangpropregular expressionhelperBigInt64Arraystyled-componentstacitdependency managerdeepclonemixinsrfc9562glacierObject.definePropertynumberUnderscorel10ni18nfetchreducegradients css3spinnerfindpostcss-pluginweaksetpnpm9someuninstallsortedremoveutilitycryptosymbolsObservabledefinereact animationtc39validationvariableselbawesomesauceArray.prototype.includesframeriamInt16ArraygetPrototypeOfspringtransportoperating-systemchaiajaxes2018Array.prototype.flattenbeanstalkbindsharedreplaybusyuploadhas-ownESslicecodespopmotionObject.entriessymbolinstallgetintrinsicarrayseslintconfigrangeerrorconcatMaplengthcommanderstreamsidlehookformMicrosoftbinariesfilterStreamsreuseoptimizerbrowserlistspecstyleguidegenericscolorArray.prototype.filtercloudsearchcss variableES8climomentdefinePropertyttystatelessbyteOffsetsideprotocol-buffersdirtslibCSSstylingrulesec2outputprogressaccessordeterministictypesautoscalingbootstrap lessmatchAllTypeScriptflatMapfromredactprefixless compilerecmascriptdataviewmkdirdataViewnamesortstyleerror-handlingroute53ECMAScript 6proxyvisualvalidasterisksgitignoreargumentexecfilereduxchannelmatchefficientnested csstakewhichimportexportStreammergelistenersformattingairbnbjapanesecloudtrailes2015setterreactcss lesscloudfrontjsdiffcircularemrtostringtageslintplugincoercibleloggerwarningprocessInt8Arrayviewtrimfast-deep-copyownmobileterminalprotobufansiString.prototype.matchAllarktypeSetfunctionalonceshamistrimEnddescriptorcallbindtimedescriptionlanguageES2018logdraghotECMAScript 5rapiddatastructureECMAScript 7functioncurriedrecursiveentriesnpmignoreparsingcollectiontoReversedES2019typeofcall-bindbytefastifybrowserslistgdprspinnersflagidentifierssignalpostcssemitkeysasciidescriptorswidthvaluelastmovereadprototypereducercss-in-jses-abstractArrayBufferfnmatchchromereact-componentES2017extraformserrorargsdom-testing-librarymrudependenciesawsglobalscolourhardlinksbufferES5regexpnodejsRegExp#flagssetPrototypeOfdynamodbpasswordWebSocketurlthreeECMAScript 2016installerlessECMAScript 2019ES2016symlinksa11yinputArrayprotoBigUint64Array__proto__RFC-6455function.lengthwaitimmutableES7WeakMappropertyresolveprettyprunewalkquotecrypt.gitignoreminimalisConcatSpreadablemodulescallbounddeepqsnegativetelephoneRxexitrandomkoreaninterruptsglobal objectassertionesECMAScript 2017globpicomatchbinrdshashwindowssetArray.prototype.flatMapObject.isdiffponyfillTypedArrayprivatereadableoffsetjshintlesscssReactiveXgesturesbabel-coreECMAScript 2018command-linefile systemObjecttraverseregular-expressionString.prototype.trimobjectcharacterhassnscensor256getoptfixed-widthpreserve-symlinksstructuredClonecore-jsramdafindLastfluxmake dirECMAScript 2015pathtypedarraysJSON-SchemaroutecoreFloat32ArraySymbolapolloconfigurablefulltoStringTagjavascriptlruunicodeIteratorvestspeedincludesworkermapreduceiees5parsemapinvariantpipeexit-codeloggingpersistenttrimRightshimtrimLeftbundlerqueuegroupByFloat64ArraycreateES2023redux-toolkittoArrayvarsequencerequest3dintrinsicgraphqlpatchUint32Arrayjsonschemaes2016Uint8ClampedArraystylesheettypanionhookseventEmitterpositivefast-clonecall-boundwindowexpressionuser-streamsfigletmkdirpinspectfsWebSocketstypeerrorzxSymbol.toStringTagclientURLselfgroupautoprefixerdeletefast-copyextendclassnameajvjoiwgetJSONECMAScript 2021bootstrap cssECMAScript 2023ECMAScript 2022Array.prototype.findLastdeepcopyinternalconfigObservablesdomhelperstouchsettingsstreamanimationvariables in cssUint8ArrayhasOwnimportequalruntimemonoreposameValueZerojQueryjsontyped arrayrgbbyteLengthsqsjson-schema-validatorflattenjwtelmutilasyncyamlcolumnsstoragegatewaylinuxrequirefunctionsPushreadablestreampackage managerforktypescriptvars_.extendtypedarraycheckschemaassertsstatusconsolebcryptstabletoolkitESnextregexUint16ArrayjestmanagertesterenvironmentsfindLastIndexrobustInt32Array0writablebannerelasticacheiterateperformantamazoncloudwatchencryptionObject.assignutilsroutingspawnio-tsFunction.prototype.nameomiteveryES3es6global this valuees7json-schemacertificatesURLSearchParamsRegExp.prototype.flagsreact posequeueMicrotaskletnamesbinarylintlocalgetOwnPropertyDescriptorArrayBuffer.prototype.sliceES6inindicatoreslint-pluginreact-hookspushagentkeyworkflowtsless cssObject.valuescss nestingless mixinsArrayBuffer#slicees8less.jsquerystringjson-schema-validationvalidatehandlersmodulequeryhigher-orderposeauthenticationzerolinkformiteratordotenvmacoswaapiexecStyleSheetreact-testing-librarydeep-cloneHyBiserializationtddlibphonenumberzods3fast-deep-clonepromiseloadingWeakSethttpseventsfastacornescapetextobjsimpledbcallECMAScript 3forEacharraybuffercompile lessglobalThisimmerpropertiescurlinferenceenumerablesubprocesssymlinkeventDispatcheres-shimsdataArray.prototype.flatfileoptionpredictableES2015dropeast-asian-widthObject.getPrototypeOfnegative zeropoint-freepackagesjsxserializerconstnative[[Prototype]]flatlazyObject.fromEntriesdirectory
5.7.83

10 months ago

4.7.83

10 months ago

4.7.82

10 months ago

4.7.81

10 months ago

4.6.81

10 months ago

4.5.81

10 months ago

4.5.80

10 months ago

4.5.79

11 months ago

4.5.78

11 months ago

4.5.77

11 months ago

4.5.76

11 months ago

4.5.75

11 months ago

4.5.74

11 months ago

4.5.73

11 months ago

4.5.72

11 months ago

4.5.71

11 months ago

4.5.70

11 months ago

4.5.69

11 months ago

4.5.68

11 months ago

4.5.67

11 months ago

4.5.66

11 months ago

4.5.65

11 months ago

4.5.64

11 months ago

4.5.63

11 months ago

4.4.63

11 months ago

3.4.63

11 months ago

3.4.62

11 months ago

3.4.61

11 months ago

3.4.60

11 months ago

3.4.59

11 months ago

3.4.58

11 months ago

3.4.57

11 months ago

3.4.56

11 months ago

3.4.55

11 months ago

3.4.54

11 months ago

3.4.53

11 months ago

3.4.52

11 months ago

3.4.51

12 months ago

3.4.50

12 months ago

3.4.49

12 months ago

3.3.49

12 months ago

3.2.49

12 months ago

3.2.48

12 months ago

3.2.47

12 months ago

3.2.46

12 months ago

3.2.45

12 months ago

3.2.44

12 months ago

3.2.43

12 months ago

3.2.42

12 months ago

3.2.41

12 months ago

3.2.40

12 months ago

3.2.39

12 months ago

3.2.38

12 months ago

3.2.37

12 months ago

3.2.36

12 months ago

3.2.35

12 months ago

3.2.34

12 months ago

3.2.33

1 year ago

3.2.32

1 year ago

3.2.31

1 year ago

3.2.30

1 year ago

3.2.29

1 year ago

3.2.28

1 year ago

3.2.27

1 year ago

3.2.26

1 year ago

3.2.25

1 year ago

3.2.24

1 year ago

3.2.23

1 year ago

3.2.22

1 year ago

3.2.21

1 year ago

3.2.20

1 year ago

3.2.19

1 year ago

3.2.18

1 year ago

3.2.17

1 year ago

3.2.16

1 year ago

3.2.15

1 year ago

3.2.14

1 year ago

3.2.13

1 year ago

3.2.12

1 year ago

3.2.11

1 year ago

3.1.11

1 year ago

3.1.10

1 year ago

3.1.9

1 year ago

3.1.8

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.0.7

1 year ago

2.0.6

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