-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/59 xts cli integration #63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ulrond
wants to merge
19
commits into
develop
Choose a base branch
from
feature/59-xts-cli-integration
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
edd3a16
Remove built-in XTSAllocatorClient plugin
Ulrond 782d1e3
Add test runner and install command specification
Ulrond f7c3a8f
Fix all test failures and update implementation
Ulrond a7f2f45
Add comprehensive test suite for XTS enhancements
Ulrond 563729a
Add comprehensive coverage analysis and improve test runner
Ulrond 56da546
Add xts.py integration tests - 30 new tests
Ulrond fdb4ed6
Add remote URL tests for xts_alias.py - 18 new tests
Ulrond fd7880b
Add plugin and validator formatting tests
Ulrond 77ca3a5
Fix wizard test API to match implementation
Ulrond ccc6034
Add directory UI interaction tests for bulk aliases
Ulrond 44ce457
Add comprehensive xts.py execution path tests
Ulrond c6e8d83
Fix wizard test failures and add comprehensive coverage
Ulrond 98f797e
Add version display and enhanced default help output
Ulrond 439b0f5
Enhance alias command listing with panel header and colors
Ulrond a3d81eb
Add repository analyzer and demo examples
Ulrond 29c2d9b
added proxy feature
Ulrond 1aeeb78
Add standard function library with 13 built-in pipeline functions
Ulrond 318704b
feat: Add centralized proxy management with multi-type support
Ulrond a537a90
feat: Add learning guide and move TAB_COMPLETION to docs
Ulrond File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| .venv | ||
| *.lastlogin | ||
| *__pycache__* | ||
| *.vscode* | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,252 @@ | ||
| # XTS Command History & Recall | ||
|
|
||
| ## Quick Command Recall | ||
|
|
||
| ### 1. **Arrow Keys** (Simplest) | ||
| - **↑ (Up Arrow)** - Recall previous command | ||
| - **↓ (Down Arrow)** - Move forward in history | ||
| - Press up arrow, then edit the command, then Enter | ||
|
|
||
| ```bash | ||
| $ xts allocator list | ||
| {"slots":[]} | ||
| $ ↑ # Brings back: xts allocator list | ||
| # Edit to: xts allocator list_free | ||
| ``` | ||
|
|
||
| ### 2. **Ctrl+R** (Reverse Search) | ||
| Search through your command history: | ||
| ```bash | ||
| $ <Ctrl+R> | ||
| (reverse-i-search)`alloc': xts allocator alloc_by_id [email protected] 1 2h | ||
| ``` | ||
| - Type to search | ||
| - Ctrl+R again to cycle through matches | ||
| - Enter to execute | ||
| - Ctrl+C to cancel | ||
|
|
||
| ### 3. **History Expansion** | ||
| Bash shortcuts for command reuse: | ||
|
|
||
| ```bash | ||
| # Repeat last command | ||
| $ xts allocator list | ||
| $ !! # Runs: xts allocator list | ||
|
|
||
| # Repeat last command with sudo | ||
| $ !! | ||
|
|
||
| # Use last argument from previous command | ||
| $ xts allocator alloc_by_id [email protected] 5 2h | ||
| $ xts allocator release !$ # !$ = "2h" (last arg) | ||
| # Better: xts allocator release [email protected] 5 | ||
|
|
||
| # Use specific argument | ||
| $ xts allocator alloc_by_id [email protected] 5 2h | ||
| $ xts allocator release !:2 !:3 # !:2 = [email protected], !:3 = 5 | ||
|
|
||
| # Repeat last command starting with "xts" | ||
| $ !xts | ||
|
|
||
| # Repeat last command containing "allocator" | ||
| $ !?allocator | ||
| ``` | ||
|
|
||
| ### 4. **Edit Last Command** | ||
| Quickly fix typos: | ||
| ```bash | ||
| $ xts allocator alloc_by_id [email protected] 5 2h # Typo: "usr" | ||
| $ ^usr^user # Replaces usr with user and runs | ||
| # Executes: xts allocator alloc_by_id [email protected] 5 2h | ||
| ``` | ||
|
|
||
| ### 5. **History Command** | ||
| View and reuse from history: | ||
| ```bash | ||
| # Show recent commands | ||
| $ history 20 | ||
|
|
||
| # Execute command by number | ||
| $ !542 # Runs command #542 from history | ||
|
|
||
| # Show only xts commands | ||
| $ history | grep xts | ||
| ``` | ||
|
|
||
| ## Enhanced Bash Configuration | ||
|
|
||
| Add these to your `~/.bashrc` for better history: | ||
|
|
||
| ```bash | ||
| # Increase history size | ||
| export HISTSIZE=10000 | ||
| export HISTFILESIZE=20000 | ||
|
|
||
| # Don't store duplicate commands | ||
| export HISTCONTROL=ignoredups:erasedups | ||
|
|
||
| # Append to history (don't overwrite) | ||
| shopt -s histappend | ||
|
|
||
| # Save multi-line commands as one entry | ||
| shopt -s cmdhist | ||
|
|
||
| # Real-time history sharing across sessions | ||
| PROMPT_COMMAND="history -a; history -n" | ||
|
|
||
| # Enable Ctrl+S for forward search (reverse of Ctrl+R) | ||
| stty -ixon | ||
| ``` | ||
|
|
||
| After adding these, reload: | ||
| ```bash | ||
| source ~/.bashrc | ||
| ``` | ||
|
|
||
| ## XTS-Specific Aliases | ||
|
|
||
| Create bash aliases for common xts commands: | ||
|
|
||
| ```bash | ||
| # Add to ~/.bashrc | ||
| alias xa='xts allocator' | ||
| alias xal='xts allocator list' | ||
| alias xalf='xts allocator list_free' | ||
| alias xaa='xts allocator alloc_by_id' | ||
| alias xar='xts allocator release' | ||
|
|
||
| # Now you can use: | ||
| $ xal # Instead of: xts allocator list | ||
| $ xaa [email protected] 5 2h # Allocate device 5 | ||
| ``` | ||
|
|
||
| ## Readline (inputrc) Enhancements | ||
|
|
||
| Add to `~/.inputrc` for better tab completion behavior: | ||
|
|
||
| ```bash | ||
| # Create/edit ~/.inputrc | ||
| $ nano ~/.inputrc | ||
| ``` | ||
|
|
||
| Add these lines: | ||
| ``` | ||
| # Show all completions immediately | ||
| set show-all-if-ambiguous on | ||
|
|
||
| # Case-insensitive completion | ||
| set completion-ignore-case on | ||
|
|
||
| # Colored completion | ||
| set colored-stats on | ||
| set colored-completion-prefix on | ||
|
|
||
| # Menu completion - cycle through options with tab | ||
| "\t": menu-complete | ||
| "\e[Z": menu-complete-backward | ||
|
|
||
| # Show completion type indicators | ||
| set visible-stats on | ||
|
|
||
| # Immediately show completion matches | ||
| set show-all-if-unmodified on | ||
| ``` | ||
|
|
||
| Reload: | ||
| ```bash | ||
| $ bind -f ~/.inputrc | ||
| ``` | ||
|
|
||
| ## Practical Workflow Examples | ||
|
|
||
| ### Example 1: Allocate, Test, Release | ||
| ```bash | ||
| # Step 1: Allocate | ||
| $ xts allocator alloc_by_id [email protected] 5 2h | ||
| {"status":"success","device_id":5} | ||
|
|
||
| # Step 2: Use it (remember the command) | ||
| $ ↑ # Recall allocation command | ||
| # Edit to release: xts allocator release [email protected] 5 | ||
| ``` | ||
|
|
||
| ### Example 2: List, Then Allocate Specific Device | ||
| ```bash | ||
| # See available devices | ||
| $ xts allocator list_free | ||
|
|
||
| # Pick one, reuse the alias name with tab completion | ||
| $ xts allocator alloc_<TAB> # Completes to alloc_by_id, alloc_by_platform, etc. | ||
| ``` | ||
|
|
||
| ### Example 3: Repeat with Modifications | ||
| ```bash | ||
| # Allocate device 5 | ||
| $ xts allocator alloc_by_id [email protected] 5 2h | ||
|
|
||
| # Release it | ||
| $ ↑ # Recall | ||
| # Change "alloc_by_id" to "release" and remove "2h" | ||
| $ xts allocator release [email protected] 5 | ||
| ``` | ||
|
|
||
| ## Advanced: fzf Integration (Optional) | ||
|
|
||
| For even better history search, install [fzf](https://github.com/junegunn/fzf): | ||
|
|
||
| ```bash | ||
| # Install | ||
| $ sudo apt install fzf # or: git clone https://github.com/junegunn/fzf.git ~/.fzf && ~/.fzf/install | ||
|
|
||
| # Add to ~/.bashrc | ||
| [ -f ~/.fzf.bash ] && source ~/.fzf.bash | ||
| ``` | ||
|
|
||
| Now: | ||
| - **Ctrl+R** - Interactive fuzzy history search with preview | ||
| - **Ctrl+T** - Fuzzy file finder | ||
| - **Alt+C** - Fuzzy directory changer | ||
|
|
||
| ## Tips & Tricks | ||
|
|
||
| 1. **Quick Edit**: Start typing a command, then ↑ to search history for commands starting with those characters | ||
|
|
||
| 2. **Job Control**: | ||
| ```bash | ||
| $ xts allocator list # Takes a while... | ||
| <Ctrl+Z> # Suspend | ||
| $ bg # Continue in background | ||
| $ fg # Bring back to foreground | ||
| ``` | ||
|
|
||
| 3. **Command Substitution**: | ||
| ```bash | ||
| # Use output of one command in another | ||
| $ DEVICE=$(xts allocator list | jq -r '.slots[0].id') | ||
| $ xts allocator alloc_by_id [email protected] $DEVICE 2h | ||
| ``` | ||
|
|
||
| 4. **For Loops for Batch Operations**: | ||
| ```bash | ||
| # Release multiple devices | ||
| $ for id in 1 2 3; do xts allocator release [email protected] $id; done | ||
| ``` | ||
|
|
||
| ## Summary | ||
|
|
||
| **Fastest methods for command recall:** | ||
|
|
||
| | Action | Method | Example | | ||
| |--------|--------|---------| | ||
| | Recall last command | `↑` | Press up arrow | | ||
| | Search history | `Ctrl+R` | Ctrl+R, type "alloc" | | ||
| | Repeat last command | `!!` | `!!` | | ||
| | Fix typo | `^old^new` | `^usr^user` | | ||
| | Use last argument | `!$` | `command !$` | | ||
|
|
||
| **After running a command, you can:** | ||
| 1. Press `↑` to recall it | ||
| 2. Press `Ctrl+R` and search for it | ||
| 3. Type the start of the command and press `↑` to search matching history | ||
|
|
||
| Unfortunately, **tab completion cannot recall history** - that's a shell limitation. But the methods above are faster than tab-tab anyway! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This README example documents the old inline proxy flags on
xts alias add, but the changelog in this PR states a breaking change to named proxy references (xts proxy add ...thenxts alias add ... --proxy <proxy_name>). Update this snippet (and any surrounding text) to reflect the new CLI so users don’t copy/paste a now-invalid command.