Global flags can be used with any command in the Nile CLI. They provide consistent functionality across all commands and help customize the CLI’s behavior.

Authentication Flags

Flags for authenticating with Nile’s services.

Authentication Examples
# Using API key
nile --api-key YOUR_API_KEY db list

# Using workspace
nile --workspace my-workspace db list

# Using database
nile --db my-database db list

# Combining flags
nile --api-key YOUR_API_KEY --workspace my-workspace db list
FlagDescriptionDefault
--api-key <key>API key for authenticationEnvironment variable: NILE_API_KEY
--workspace <name>Workspace to useEnvironment variable: NILE_WORKSPACE
--db <name>Database to useEnvironment variable: NILE_DB

Output Format Flags

Customize how command output is displayed.

Format Examples
# JSON output
nile --format json db list

# CSV output
nile --format csv db list

# Disable colors
nile --no-color db list
FlagDescriptionDefault
--format <type>Output format (human, json, csv)human
--colorEnable colored outputtrue
--no-colorDisable colored output-

Host Configuration Flags

Configure connection endpoints for Nile services.

Host Configuration
# Custom database host
nile --db-host custom.db.example.com db list

# Custom global host
nile --global-host api.example.com db list

# Custom auth URL
nile --auth-url auth.example.com connect login
FlagDescriptionDefault
--db-host <host>Custom database hostEnvironment variable: NILE_DB_HOST
--global-host <host>Custom global hostEnvironment variable: NILE_GLOBAL_HOST
--auth-url <url>Custom authentication URLEnvironment variable: NILE_AUTH_URL

Debug Flag

Enable detailed output for troubleshooting.

Debug Examples
# Enable debug output
nile --debug db list

# Debug with other flags
nile --debug --format json db list

# Debug authentication
nile --debug connect login
FlagDescriptionDefault
--debugEnable debug outputfalse

Environment Variables

All global flags can also be set using environment variables:

Environment Variables
# Authentication
export NILE_API_KEY=your-api-key
export NILE_WORKSPACE=your-workspace
export NILE_DB=your-database

# Host Configuration
export NILE_DB_HOST=your-db-host
export NILE_GLOBAL_HOST=your-global-host
export NILE_AUTH_URL=your-auth-url

# Debug Mode
export NILE_DEBUG=true

Flag Precedence

When the same setting is specified in multiple ways, the following precedence order is used (highest to lowest):

  1. Command line flags
  2. Environment variables
  3. Configuration file values
  4. Default values
Precedence Examples
# Flag overrides environment variable
export NILE_WORKSPACE=workspace1
nile --workspace workspace2 db list  # Uses workspace2

# Flag overrides config
nile config --workspace workspace1
nile --workspace workspace2 db list  # Uses workspace2

Was this page helpful?