hugoalh-studio / argv-nodejs

A NodeJS module to correctly slice off `process.argv`.

Home Page:https://www.npmjs.com/package/@hugoalh/argv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Argv (NodeJS)

License GitHub Repository GitHub Stars GitHub Contributors GitHub Issues GitHub Pull Requests GitHub Discussions CodeFactor Grade

Releases Latest (GitHub Latest Release Date) Pre (GitHub Latest Pre-Release Date)
GitHub GitHub Total Downloads GitHub Latest Release Version GitHub Latest Pre-Release Version
NPM NPM Total Downloads NPM Latest Release Version NPM Latest Pre-Release Version

📝 Description

A NodeJS module to correctly slice off process.argv.

📚 Documentation

Getting Started

  • NodeJS ^ v12.20.0 || ^ v14.15.0 || >= v16.13.0
npm install @hugoalh/argv
/* Either */
import { ... } from "@hugoalh/argv";// Named Import
import * as argv from "@hugoalh/argv";// Namespace Import

API

Value

  • args: <string[]> Additional command line arguments.
  • binIndex: <0 | 1> Index of bin in process.argv.
  • binPath: <string> Path of the file is execute.
  • isBundledElectronJSProgram: <boolean> Whether the process is execute from bundled ElectronJS program.
  • isElectronJSProgram: <boolean> Whether the process is execute from ElectronJS program.
  • isUnbundledElectronJSProgram: <boolean> Whether the process is execute from unbundled ElectronJS program.
  • programPath: <string> Path of the executable file is execute.

Example

argv.________ node bin.js args1 args2 ...argsn bin args1 args2 ...argsn electron bin.js args1 args2 ...argsn
args ["args1", "args2", ..., "argsn"] ["args1", "args2", ..., "argsn"] ["args1", "args2", ..., "argsn"]
binIndex 1 0 1
binPath "/path-to/bin.js" "/path-to/bin" "/path-to/bin.js"
isBundledElectronJSProgram false true false
isElectronJSProgram false true true
isUnbundledElectronJSProgram false false true
programPath "/path-to/node" "/path-to/bin" "/path-to/electron"

About

A NodeJS module to correctly slice off `process.argv`.

https://www.npmjs.com/package/@hugoalh/argv

License:Other


Languages

Language:TypeScript 100.0%