3.0.2 â€ĸ Published 2 months ago

@hugoalh/argv v3.0.2

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

Argv (NodeJS)

⚖ī¸ MIT

🗂ī¸ GitHub: hugoalh-studio/argv-nodejs NPM: @hugoalh/argv

🆙 Latest Release Version (Latest Release Date)

A NodeJS module to correctly slice off process.argv.

đŸŽ¯ Target

  • NodeJS >= v16.13.0

🔰 Usage

  1. Install via console/shell/terminal:
    • Via NPM
      npm install @hugoalh/argv[@<Tag>]
    • Via PNPM
      pnpm add @hugoalh/argv[@<Tag>]
    • Via Yarn
      yarn add @hugoalh/argv[@<Tag>]
  2. Import at the script (<ScriptName>.js):
    import ... from "@hugoalh/argv";

    ℹī¸ Note

    Although it is recommended to import the entire module, it is also able to import part of the module with sub path if available, please visit file package.json property exports for available sub paths.

🧩 API

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

✍ī¸ Example

argv.________node bin.js args1 args2 ...argsnbin args1 args2 ...argsnelectron bin.js args1 args2 ...argsn
args["args1", "args2", ..., "argsn"]["args1", "args2", ..., "argsn"]["args1", "args2", ..., "argsn"]
binIndex101
binPath"/path-to/bin.js""/path-to/bin""/path-to/bin.js"
isBundledElectronJSProgramfalsetruefalse
isElectronJSProgramfalsetruetrue
isUnbundledElectronJSProgramfalsefalsetrue
programPath"/path-to/node""/path-to/bin""/path-to/electron"
3.0.2

2 months ago

3.0.1

4 months ago

3.0.0

4 months ago

2.0.2

8 months ago

2.0.1

10 months ago

2.0.0

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago