Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.github.themrmilchmann.kopt:kopt
Advanced tools
kopt is a small command line parser library for the JVM.
kopt is fully compatible with Java 8 and Kotlin 1.1 (or later).
Command line
--
) terminates option parsing. Thus, section (3) is effectively
irrelevant for anything that is parsed after this character sequence
and even literals prefixed with hyphens are interpreted as arguments.Arguments
Arguments are interpreted index-based.
Optional arguments
An argument may be optional, that is, it is not required to pass a value for said argument.
Vararg arguments
The trailing argument may be a vararg argument, that is,
Options
Options are interpreted key-based.
Option tokens An option token is used to identify an option. Two different kinds of tokens exist.
Option tokens are case-sensitive.
Long token
A long token is an alphanumeric literal.
An alphanumeric literal prefixed with a double hyphen delimiter
(--
) is interpreted as long option token.
Short token
A short token is an alphabetic character.
An alphabetic character prefixed with a single hyphen delimiter
(-
) is interpreted as short option token.
Multiple short tokens may be chained behind a single hyphen
delimiter. Thus, -a -b -c
and -abc
are equivalent. (Furthermore,
-a <value> -b <value> -c <value>
and -abc <value>
are
equivalent.)
Short tokens may only be chained if the way the represented options
parse values do not conflict.
An alphabetic literal prefixed with a single hyphen delimiter
(-
) is interpreted as a set of chained short option tokens.
If an option token and a following string are separated by either an
equals sign (=
) or a single whitespace character (e.g. a space
),
the string is interpreted as a value for the option represented by the
token.
Marker options
An option may be a marker option, that is, the option does not require a
value to be passed and will instead use a predefined value if the option is
present and no value is passed.
Additionally, an option may be a marker-only option, that is, the option
does not accept a value to be passed.
This section informally explains the grammar notation used below.
|
denotes alternative.*
denotes iteration (zero or more).+
denotes iteration (one or more).?
denotes option (zero or one).start
commandLine
: argument+ ("--" string*)?
;
argument
: string
: option
;
option
: defaultOption
: markerOption
: markerOnlyOption
;
defaultOption
: "-" ShortToken+ "=" String
: "-" ShortToken+ " " String
: "--" LongToken "=" String
: "--" LongToken " " String
;
markerOption
: defaultOption
: markerOnlyOption
;
markerOnlyOption
: "-" ShortToken+
: "--" LongToken
;
ShortOptionToken
: <any alphabetic character>
;
LongOptionToken
: <any alphanumeric character>+
;
String
: Literal
: "\"" <any character>* "\""
;
FAQs
Simple CLI argument parser for the JVM
We found that com.github.themrmilchmann.kopt:kopt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.