-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Enhancement: Improve CLI Interface Usability and Features
Current State
The current CLI interface provides basic functionality for printing templates and managing settings, but there are several areas where we can enhance user experience and add helpful features.
Proposed Improvements
1. Command Structure and Help System
- Add command groups/categories for better organization
- Enhance help messages with examples for each command
- Add a
--verboseflag for detailed output / Hide logs without the flag - Implement command aliases for frequently used commands
- Add command auto-completion support
2. Template Management
- Add command to list available templates with descriptions
- Add command to preview template output without printing
- Allow saving default values for template variables
- Add ability to validate template input before printing
- Support for template variables with default values
3. Interactive Mode
- Add an interactive shell mode for multiple operations
- Implement history for recent commands and inputs
- Add tab completion for template names and commands
- Support for saving recent template inputs
4. Configuration Management
- Add command to validate configuration
- Support for multiple printer profiles
- Add backup/restore functionality for settings
- Interactive configuration wizard for first-time setup
- Command to reset settings to defaults
5. Error Handling and Feedback
- Improve error messages with suggested fixes
- Add progress indicators for long-running operations
- Add dry-run option for commands
- Implement retry mechanism for failed print attempts
- Add logging levels control via CLI flags
6. Noninteractive Mode
- Add
--noninteractiveflag for automated/scripted usage - Support JSON/YAML input files for template variables
- Add environment variable support for template variables
- Support stdin for template content
- Allow command-line arguments for all template variables
- Add batch processing without user prompts
7. New Features
- Add command to test printer connectivity
- Support for batch printing multiple templates
- Add command to export/import templates
- Support for template variables validation rules
- Add command to show printer status
Technical Implementation Details
- Use
richlibrary for improved terminal output - Implement command groups using Typer's
typer.Typer() - Add shell completion using Click's completion API
- Use
pydanticfor configuration validation - Implement command history using
python-prompt-toolkit - Implement argument parsing for noninteractive mode
- Add support for reading template variables from files and environment
Example Usage After Implementation
# Interactive mode
printerm shell
# Template preview
printerm template preview task --with-sample-data
# Printer profile management
printerm config profiles add office --ip 192.168.1.100
printerm config profiles switch office
# Batch printing
printerm print-batch orders.json --template invoice
# Template validation
printerm template validate custom_template.yaml
# Printer connectivity test
printerm printer test
# Noninteractive mode with command line arguments
printerm print-template task --noninteractive --title="Bug Fix" --content="Fixed issue #123"
# Using input file for template variables
printerm print-template task --input-file task_data.json --noninteractive
# Reading content from stdin
echo "Meeting notes content" | printerm print-template note --noninteractive --title="Meeting Notes"
# Using environment variables
export PRINTERM_TEMPLATE_TITLE="Daily Report"
export PRINTERM_TEMPLATE_CONTENT="Today's progress..."
printerm print-template note --noninteractive --use-env
# Batch processing with JSON input
printerm print-batch --noninteractive --input-file batch_jobs.json
# Example task_data.json:
{
"title": "Bug Fix",
"content": "Fixed issue with login screen",
"priority": "high"
}
# Example batch_jobs.json:
{
"jobs": [
{
"template": "task",
"variables": {
"title": "Task 1",
"content": "Content for task 1"
}
},
{
"template": "note",
"variables": {
"title": "Note 1",
"content": "Content for note 1"
}
}
]
}Acceptance Criteria
- All new commands have comprehensive help messages and examples
- Command completion works in supported shells (bash, zsh, fish)
- Configuration changes are validated before saving
- Interactive mode supports history and tab completion
- Error messages are clear and actionable
- New features are documented in README.md
- Added unit tests for new functionality
- Performance impact is minimal
- Maintains backward compatibility with existing commands
- Noninteractive mode works with all templates
- Template variables can be provided via files, environment variables, and command line arguments
- Batch processing supports multiple templates without user interaction
- Clear documentation for noninteractive mode usage
- Error handling provides appropriate exit codes for scripting
- Variable validation works in noninteractive mode
Implementation Priority
- Noninteractive Mode (New highest priority)
- Error Handling and Feedback improvements
- Command Structure and Help System
- Template Management enhancements
- Interactive Mode
- Configuration Management
- New Features
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request