Shell configuration manager supporting 16 shells
shtick allows you to organize shell aliases, environment variables, and functions into manageable groups that can be activated/deactivated across 16 different shell environments. Changes take effect immediately with the auto-sourcing wrapper. Written in C for portability with no runtime dependencies.
The setup script configures auto-sourcing. Or manually add to your shell config:
shtick generates configuration for 16 shells:
bashzshfishkshtcshcshdashashmkshpdkshyashxonshelvishnuionpwsh
Configuration is stored in ~/.config/shtick/config.toml using TOML format:
~/.config/shtick/
├── config.toml # Main configuration
├── active_groups # List of active group names
├── settings.conf # User preferences
├── backups/ # Backup directory
├── load_active.bash # Generated loader for bash
├── load_active.zsh # Generated loader for zsh
├── load_active.fish # Generated loader for fish
└── completion.bash # Shell completions | Option | Type | Default | Description |
|---|---|---|---|
auto_source_prompt | boolean | true | Prompt to apply changes immediately |
check_conflicts | boolean | true | Warn about duplicate aliases/vars |
backup_on_save | boolean | false | Auto-backup before changes |
max_auto_backups | integer | 10 | Keep N most recent backups |
parallel_generation | boolean | false | Generate all shells in parallel |
shells | string | (empty) | Comma-separated shell list (empty = all) |
The persistent group is special:
shtick is a shell configuration manager that organizes aliases, environment variables, and functions into groups. Groups can be activated/deactivated to load different configurations for different contexts (work, personal, gaming, etc.).
Groups can be activated/deactivated. Only active groups' items are loaded into your shell:
shtick generates shell-specific code for each supported shell:
Each shell receives properly formatted syntax. For example, Fish uses
set -gx VAR value instead of export VAR=value.
The auto-sourcing wrapper makes changes apply immediately without manual
source commands. The wrapper:
shtick is implemented in C (~3,500 lines) across 16 modules. The architecture separates configuration persistence, code generation, and shell-specific escaping.
shtick/
├── shtick.h # Data structures & declarations
├── main.c # Command dispatcher (~650 LOC)
├── config.c # TOML persistence (~410 LOC)
├── groups.c # Group lifecycle
├── aliases.c # Alias management
├── env.c # Environment variable management
├── functions.c # Function management (~310 LOC)
├── generator.c # Multi-shell code gen (~650 LOC)
├── escape.c # Shell-specific escaping (~270 LOC)
├── completions.c # Shell completion gen (~400 LOC)
├── display.c # Status output
├── utils.c # Shared utilities (~280 LOC)
├── source_cmd.c # Auto-sourcing helper
├── settings.c # User preferences
├── backup.c # Backup/restore
├── batch.c # Bulk operations
└── wrapper.c # Wrapper generation
The config.c module handles TOML parsing and writing:
[group.aliases], [group.env], [group.functions] sections
The generator.c module creates shell-specific loader files:
load_active.<shell>
The escape.c module handles security and syntax:
User Command
↓
main.c parses arguments
↓
Item added/removed
↓
config.save_config() → writes config.toml
↓
generator.generate_shell_file()
↓
For each shell:
- escape values
- format syntax
- write load_active.<shell>
↓
If auto-sourcing:
- source load_active.<shell> shtick uses a two-phase configuration approach:
This separation allows regenerating files anytime without losing config, and makes it easy to add new shells.
| Option | Type | Default | Description |
|---|---|---|---|
shtick alias | command | - | Show all aliases |
shtick alias <key> | command | - | Show specific alias |
shtick alias <key=value> | command | - | Add alias to persistent |
shtick env | command | - | Show all environment variables |
shtick env <KEY=value> | command | - | Add env var to persistent |
shtick function | command | - | Show all functions |
shtick function <name> | command | - | Open $EDITOR for function |
shtick function <name=body> | command | - | Add function to persistent |
shtick function -f <file> <name> | command | - | Import function from file |
| Option | Type | Default | Description |
|---|---|---|---|
shtick create <group> | command | - | Create new group |
shtick delete <group> | command | - | Delete group and all items |
shtick rename <old> <new> | command | - | Rename group |
shtick groups | command | - | List all groups with item counts |
shtick activate <group> | command | - | Activate group (load in shell) |
shtick deactivate <group> | command | - | Deactivate group |
shtick add <type> <group> <item> | command | - | Add item to specific group |
shtick remove <type> <group> <search> | command | - | Remove item from group |
| Option | Type | Default | Description |
|---|---|---|---|
shtick generate <shell> | command | - | Generate for specific shell |
shtick generate all | command | - | Generate for all 16 shells |
shtick wrapper [shell] | command | - | Show auto-sourcing wrapper |
shtick completions <shell> | command | - | Generate shell completions |
shtick shells | command | - | List all supported shells |
| Option | Type | Default | Description |
|---|---|---|---|
shtick status | command | - | Complete status overview |
shtick list | command | - | List all items by group |
shtick init [shell] | command | - | Show setup instructions |
shtick settings | command | - | Show current settings |
shtick settings set <k> <v> | command | - | Update setting |
shtick backup create [name] | command | - | Create backup |
shtick backup list | command | - | List backups |
shtick backup restore <name> | command | - | Restore backup |
Cause: Auto-sourcing wrapper not configured.
Cause: Shell-specific syntax differences.