A powerful command-line interface for CodeMenu, allowing you to access and manage your code snippets from the terminal.
- Search & Filter: Search snippets by query, language, tag, or group
- Multiple Output Formats: JSON, table, or raw code output for easy piping
- Interactive TUI: Beautiful terminal user interface for browsing snippets
- Configuration Management: Save API keys and settings for quick access
- Pipeline-Ready: Designed for use in CI/CD pipelines and automation scripts
git clone https://github.com/extiri/cdmn.git
cd cdmn
go build -o cdmn
sudo mv cdmn /usr/local/bin/go install github.com/extiri/cdmn@latest- CodeMenu API must be enabled in CodeMenu settings
- By default, the API runs at
http://127.0.0.1:1300/v1 - If you've enabled key protection, you'll need your API key
If your CodeMenu instance requires an API key:
cdmn config set --api-key your-api-key-herecdmn snippetscdmn tui# List all snippets
cdmn snippets
# Search for snippets
cdmn snippets --query "function"
# Filter by language
cdmn snippets --language python
# Filter by tag ID
cdmn snippets --tag TAG-UUID-HERE
# Filter by group ID
cdmn snippets --group GROUP-UUID-HERE
# Combine filters
cdmn snippets --query "async" --language javascript
# Output as JSON
cdmn snippets --output json
# Output only code (for piping)
cdmn snippets --output code# Get snippet by ID (text format)
cdmn get SNIPPET-ID
# Get snippet by title using fuzzy search (text format)
cdmn get "part of the name"
# Get snippet as JSON
cdmn get SNIPPET-ID --output json
# Get only the code
cdmn get SNIPPET-ID --output code# List tags as table
cdmn tags
# List tags as JSON
cdmn tags --output json# List groups as table
cdmn groups
# List groups as JSON
cdmn groups --output json# Start the interactive interface
cdmn tuiTUI Controls:
↑/↓orj/k- Navigate snippets/- Search snippetsEnter- View snippet detailsEsc- Go backq- Quit
# Show current configuration
cdmn config show
# Set API key
cdmn config set --api-key YOUR_KEY
# Set custom base URL
cdmn config set --base-url http://localhost:8080/v1
# Set custom port
cdmn config set --port 8080All commands support these flags:
--api-key- Override API key from config--base-url- Override base URL from config--config- Specify custom config file location
Configuration is stored in ~/.config/cdmn/.cdmn.yaml by default.
Example configuration:
api_key: your-secret-key
base_url: http://127.0.0.1:1300/v1
port: 1300You can also use environment variables:
export CDMN_API_KEY=your-secret-key
export CDMN_BASE_URL=http://127.0.0.1:1300/v1
export CDMN_PORT=1300# Save snippet code to file
cdmn get SNIPPET-ID --output code > script.sh
chmod +x script.sh
./script.sh# Get all Python snippets and process them
cdmn snippets --language python --output json | jq -r '.[].code'# macOS
cdmn snippets --query "docker" --output code | head -n 1 | pbcopy
# Linux
cdmn snippets --query "docker" --output code | head -n 1 | xclip -selection clipboardHuman-readable table format, perfect for terminal viewing.
Machine-readable JSON output, ideal for processing with jq or other tools.
Raw code output only, perfect for piping directly to files or other commands.
This CLI uses the CodeMenu HTTP API. For more details, see:
cdmn/
├── cmd/ # CLI commands (cobra)
│ ├── root.go
│ ├── snippets.go
│ ├── get.go
│ ├── tags.go
│ ├── groups.go
│ ├── config.go
│ └── tui.go
├── internal/
│ ├── client/ # API client
│ ├── config/ # Configuration management
│ └── tui/ # Terminal UI (bubbletea)
├── main.go
├── go.mod
└── README.md
- cobra - CLI framework
- viper - Configuration management
- bubbletea - TUI framework
- lipgloss - Terminal styling
- bubbles - TUI components
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.
For issues and questions:
- CodeMenu: https://docs.extiri.com/CodeMenu/
- API Documentation: https://docs.extiri.com/CodeMenuAPI/
Created for the CodeMenu ecosystem by Extiri.