Overview
Shell mode provides an interactive REPL (Read-Eval-Print Loop) environment for the CoinPaprika CLI, allowing you to run multiple commands without repeatedly typing the CLI name.Starting Shell Mode
Using the Shell
Running Commands
Type any CLI command without thecoinpaprika-cli prefix:
Command History
The shell maintains a command history that you can navigate using arrow keys:- Up Arrow: Previous command
- Down Arrow: Next command
Quoted Arguments
The shell supports both single and double quotes for arguments containing spaces:split_args function (src/shell.rs:61-92) handles quote parsing to ensure proper argument separation.
Exiting the Shell
There are multiple ways to exit shell mode:-
Type
exit: -
Type
quit: - Press Ctrl+D (EOF signal)
-
Press Ctrl+C (will show a reminder):
Note: Ctrl+C does not exit the shell, only interrupts the current input.
Shell Behavior
Empty Lines
Pressing Enter on an empty line is ignored — the shell will simply display the prompt again.Command Parsing
All commands are parsed using the same argument parser as the main CLI. This means:- All global flags work (
--output,--api-key,--raw) - All subcommands and their options are supported
- Invalid commands show the same error messages as the regular CLI
Error Handling
If a command fails, the error is displayed, but the shell continues running:Use Cases
Interactive Data Exploration
Testing API Queries
Shell mode is ideal for testing and refining queries before using them in scripts:Switching Output Formats
Technical Details
Implementation
The shell is built using therustyline library, which provides:
- Line editing capabilities
- Command history
- Keyboard shortcuts (Ctrl+C, Ctrl+D)
- Cross-platform terminal support
Global Flags in Shell Mode
All global flags can be used with any command in the shell:Tips
- Use shell mode for experimentation — it’s faster than typing the full CLI name repeatedly
- Combine with
--output jsonto inspect full API responses - Use arrow keys to quickly re-run previous commands with modifications
- Shell mode respects your config — API keys from
config.tomlare automatically loaded