Syntax
Description
The interactive shell provides a dedicated environment for running multiple commands without repeatedly typingdzdk. It includes advanced features to improve productivity and user experience.
Features
Command History
- All commands are saved to history file
- History persists across sessions
- Navigate history with up/down arrows
- History file location:
~/.dzdk/history
Auto-Completion
- Tab completion for all commands
- Supports multi-word commands
- Context-aware suggestions
- Command category grouping
Auto-Suggest
- Suggestions from command history
- Gray text showing previous similar commands
- Accept suggestions with right arrow key
Session Management
- Persistent shell session
- Command output captured and formatted
- Graceful error handling
- Clean exit with Ctrl+C or
exitcommand
Starting the Shell
Shell Commands
help
Show available commands and categories.clear
Clear the terminal screen and redisplay the welcome message.exit
Exit the interactive shell.- Press
Ctrl+Cto interrupt and exit - Press
Ctrl+Dfor EOF exit
Available Command Categories
The shell organizes commands into categories:Health
health- Check API health status
Services
services list- List all servicesservices get- Get service details
Events
events list- List all eventsevents get- Get event details
Photos
photos list- List photosphotos get- Get photo detailsphotos upload- Upload new photophotos metadata- View metadataphotos edit- Edit photo detailsphotos album create- Create albumphotos album add- Add to albumphotos album list- List albums
Population
population stats- View statisticspopulation get- Get demographics
Resources
resources list- List resourcesresources get- Get resource detailsresources fetch- Download resource
Search
search- Search across all resources
Batch
batch download- Download multiple filesbatch upload- Upload multiple files
Export
export csv- Export to CSVexport report- Generate report
Config
config- Configure CLI settings
Usage Examples
Basic Command Execution
Using Command History
Tab Completion
Multi-Command Session
Command Execution
Command Parsing
Commands are executed as if run withdzdk prefix:
Options and Arguments
All options work the same as in regular CLI:Error Handling
Errors are displayed without exiting the shell:History Management
History File
Commands are automatically saved to:History Navigation
- Up Arrow: Previous command
- Down Arrow: Next command
- Ctrl+R: Reverse search history
- Ctrl+S: Forward search history
Auto-Suggestions
As you type, the shell suggests commands from history:Prompt Customization
The shell uses a simple prompt:Exiting the Shell
Normal Exit
Keyboard Interrupt
Error Exit
If the shell encounters a critical error:Advanced Features
Session Persistence
- Command history persists between sessions
- Configuration settings are maintained
- Shell state is saved on clean exit
Output Capture
- All command output is properly formatted
- Rich console formatting preserved
- Progress bars and spinners work correctly
Command Aliases
The shell recognizes all standard CLI commands without thedzdk prefix.
Shell-Specific Help
View help within the shell:Technical Details
Implementation
- Built on Python’s
cmdmodule - Uses
prompt_toolkitfor enhanced features - Integrates with Click command framework
- Rich console for formatted output
File Locations
Completion Data
Command completions are automatically generated from all registered CLI commands and organized by category.Tips
- Use tab completion to discover available commands
- Navigate history with arrow keys for efficiency
- Use help command to explore features
- Chain operations - run multiple commands in one session
- Clear screen when output gets cluttered
Limitations
- No command piping or redirection within shell
- No command aliases (use full command names)
- No background job execution
- No variable expansion or scripting
Error Messages
Shell Start Error:Notes
- Shell is designed for interactive use only
- Not suitable for scripting (use regular CLI for scripts)
- History file grows over time (manual cleanup may be needed)
- Exit cleanly to ensure history is saved
- All regular CLI commands work in shell mode