Skip to content

getProcessArguments

Returns the process arguments passed from the command line.

Example

ts
import { 
A
, type
ExpectType
,
S
} from "@duplojs/utils";
import {
getProcessArguments
} from "@duplojs/server-utils";
const
argumentsList
=
getProcessArguments
();
const
portArgument
=
A
.
find
(
argumentsList
,
S
.
startsWith
("--port="),
); type
check
=
ExpectType
<
typeof
portArgument
,
`--port=${string}` | undefined, "strict" >; if (
A
.
includes
(
argumentsList
, "--verbose")) {
// has verbose flag }

Syntax

typescript
function getProcessArguments(): string[]

Parameters

This function takes no parameters.

Return value

  • string[] : command-line arguments after the executable/script part.

See also

Released under the MIT license.