Results for “argument”
Small, practical examples. Search by task or narrow things down below.
Separate an executable from default arguments
Docker / Compose: Separate an executable from default arguments with a complete introductory Dockerfile.
Docker / Compose✓ Tested
Use a build argument while creating an image
Docker / Compose: ARG supplies a build-time value that is not automatically a runtime environment variable.
Docker / Compose✓ Tested
Validate a required argument
Java: Use requireNonNull with a useful message at an API boundary.
Java✓ Tested
Validate an argument at a method boundary
C#: ThrowIfNegative gives callers an explicit argument error for an invalid range.
C#✓ Tested
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested
Choose among several numeric ranges
Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.
Bash Scripts✓ Tested
Classify a filename with shell patterns
Bash Scripts: Case patterns support alternatives without launching an external regex tool.
Bash Scripts✓ Tested
Compare a value literally inside a conditional
Bash Scripts: Quoting the right side of an equality test makes wildcard characters literal.
Bash Scripts✓ Tested
Give a function its own positional parameters
Bash Scripts: A function receives its call arguments without replacing the caller’s positional parameters.
Bash Scripts✓ Tested
Parse a short option with getopts
Read a named option and handle invalid flags explicitly.
getopts✓ Tested
Parse a small set of long options
Bash Scripts: Use a loop and case statement to consume a value-bearing long option.
Bash Scripts✓ Tested
Read positional parameters in a function
Bash Scripts: Read positional parameters in a function with a small standalone Bash program.
Bash Scripts✓ Tested