-
-
Notifications
You must be signed in to change notification settings - Fork 779
added aliases and completion for ansible, ansible-dev, molecule; removed plugin ansible #734
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
Draft
PascalKont
wants to merge
9
commits into
ohmybash:master
Choose a base branch
from
PascalKont:aliases/ansible
base: master
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.
Draft
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2c0a5e5
deleted plugin ansible
PascalKont d141f22
added ansible aliases
PascalKont 41ff61e
added ansible-dev aliases
PascalKont 74b33f4
added molecule aliases
PascalKont 4c98773
fixed typo in ansible.aliases.bash
PascalKont e18ddee
improved comments
PascalKont baf1da7
updated plugins and aliases README.md
PascalKont 42c42c2
added ansible completions
PascalKont 5d5e548
added molecule completion
PascalKont 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
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,23 @@ | ||
| #! bash oh-my-bash.module | ||
|
|
||
| # kept for backwards compatbility, these used to be functions in the previous oh-my-bash ansible plugin | ||
| alias ansible-role-init='ansible-galaxy init role ' | ||
| alias arinit='ansible-role-init' | ||
|
|
||
| # ansible-dev-tools: https://docs.ansible.com/projects/dev-tools/ | ||
| alias abu='ansible-builder ' # did not want to use 'ab', as it is an existing command for Apache benchmarking tool | ||
| alias abb='ansible-builder build ' | ||
| alias abc='ansible-builder create ' | ||
| alias abi='ansible-builder introspect ' | ||
| alias acr='ansible-creator ' | ||
| alias acra='ansible-creator add ' | ||
| alias acri='ansible-creator init ' | ||
| #alias ade='ansible-dev-environment ' # this package already comes with ade alias | ||
| #alias adt='ansible-dev-tools ' # this package already comes with adt alias | ||
| alias alint='ansible-lint ' | ||
| alias anav='ansible-navigator ' | ||
| alias arunner='ansible-runner ' | ||
| alias arun='ansible-runner run ' | ||
| alias astart='ansible-runner start ' | ||
| alias astop='ansible-runner stop ' | ||
| alias asign='ansible-sign ' |
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,18 @@ | ||
| #! bash oh-my-bash.module | ||
|
|
||
| # kept for backwards compatbility, these used to be functions in the previous oh-my-bash ansible plugin | ||
| alias aver='ansible --version; ansible-community --version' | ||
| #alias arinit='ansible-role-init' # this alias can now be found in the ansible-dev aliases | ||
|
|
||
| # ansible-core: https://docs.ansible.com/projects/ansible-core/devel/ | ||
| alias a='ansible ' | ||
| alias aconf='ansible-config ' | ||
| alias acon='ansible-console ' | ||
| alias adoc='ansible-doc ' | ||
| alias agal='ansible-galaxy ' | ||
| alias ainv='ansible-inventory ' | ||
| alias aplay='ansible-playbook ' | ||
| alias aplaybook='aplay' # this long version of the playbook alias is kept for backwards compatibility | ||
| alias apull='ansible-pull ' | ||
| alias atest='ansible-test ' | ||
| alias aval='ansible-vault ' | ||
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,23 @@ | ||
| #! bash oh-my-bash.module | ||
|
|
||
| # molecule: https://docs.ansible.com/projects/molecule/ | ||
| alias mol='molecule ' | ||
| alias mhlp='molecule --help ' | ||
| alias mchk='molecule check ' | ||
| alias mcln='molecule cleanup ' | ||
| alias mcnv='molecule converge ' | ||
| alias mcrt='molecule create ' | ||
| alias mdep='molecule dependency ' | ||
| alias mdes='molecule destroy ' | ||
| alias mdrv='molecule drivers ' | ||
| alias midm='molecule idempotence ' | ||
| alias minit='molecule init scenario ' | ||
| alias mlst='molecule list ' | ||
| alias mlgn='molecule login ' | ||
| alias mtrx='molecule matrix ' | ||
| alias mprp='molecule prepare ' | ||
| alias mrst='molecule reset ' | ||
| alias msef='molecule side-effect ' | ||
| alias msyn='molecule syntax ' | ||
| alias mtest='molecule test ' | ||
| alias mvrf='molecule verify ' |
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,29 @@ | ||
| #! bash oh-my-bash.module | ||
|
|
||
| function _omb_completion_ansible { | ||
| local -A commands=( | ||
| [a]='ansible' | ||
| [aconf]='ansible-config' | ||
| [acon]='ansible-console' | ||
| [adoc]='ansible-doc' | ||
| [agal]='ansible-galaxy' | ||
| [ainv]='ansible-inventory' | ||
| [aplay]='ansible-playbook' | ||
| [aplaybook]='ansible-playbook' | ||
| [apull]='ansible-pull' | ||
| [atest]='ansible-test' | ||
| [aval]='ansible-vault' | ||
| ) | ||
| _python_argcomplete_global "${commands[$1]}" -- "${COMP_WORDS[@]:1}" | ||
| } | ||
| complete -F _omb_completion_ansible a | ||
| complete -F _omb_completion_ansible aconf | ||
| complete -F _omb_completion_ansible acon | ||
| complete -F _omb_completion_ansible adoc | ||
| complete -F _omb_completion_ansible agal | ||
| complete -F _omb_completion_ansible ainv | ||
| complete -F _omb_completion_ansible aplay | ||
| complete -F _omb_completion_ansible aplaybook | ||
| complete -F _omb_completion_ansible apull | ||
| complete -F _omb_completion_ansible atest | ||
| complete -F _omb_completion_ansible aval |
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,96 @@ | ||
| #! bash oh-my-bash.module | ||
|
|
||
| # This file was written with the assistance of Copilot (GPT-5.2) | ||
| # based on an zsh implementaion found here https://github.com/ohmyzsh/ohmyzsh/pull/13587 | ||
|
|
||
| # Only enable completion if molecule exists | ||
| command -v molecule >/dev/null 2>&1 || return 0 | ||
|
|
||
| # Cache dir (pick one) | ||
| : "${BASH_CACHE_DIR:=${XDG_CACHE_HOME:-$HOME/.cache}/bash}" | ||
| mkdir -p "$BASH_CACHE_DIR/completions" | ||
|
|
||
| _molecule_comp="$BASH_CACHE_DIR/completions/molecule.bash" | ||
|
|
||
| # (Re)generate if missing (you can add your own staleness logic) | ||
| if [[ ! -f "$_molecule_comp" ]]; then | ||
| _MOLECULE_COMPLETE=bash_source molecule >"$_molecule_comp" 2>/dev/null | ||
| fi | ||
|
|
||
| # Load the completion | ||
| # shellcheck source=/dev/null | ||
| [[ -s "$_molecule_comp" ]] && source "$_molecule_comp" | ||
|
|
||
| # Only add alias completion if the aliases exist | ||
| if [[ $(_omb_util_alias "mol" 2>/dev/null) ]]; then | ||
|
|
||
| function _omb_completion_molecule { | ||
| local -A commands=( | ||
| [mol]='molecule' | ||
| [mhlp]='molecule --help' | ||
| [mchk]='molecule check' | ||
| [mcln]='molecule cleanup' | ||
| [mcnv]='molecule converge' | ||
| [mcrt]='molecule create' | ||
| [mdep]='molecule dependency' | ||
| [mdes]='molecule destroy' | ||
| [mdrv]='molecule drivers' | ||
| [midm]='molecule idempotence' | ||
| [minit]='molecule init scenario' | ||
| [mlst]='molecule list' | ||
| [mlgn]='molecule login' | ||
| [mtrx]='molecule matrix' | ||
| [mprp]='molecule prepare' | ||
| [mrst]='molecule reset' | ||
| [msef]='molecule side-effect' | ||
| [msyn]='molecule syntax' | ||
| [mtest]='molecule test' | ||
| [mvrf]='molecule verify' | ||
| ) | ||
| # Save original words | ||
| local -a _orig_comp_words=("${COMP_WORDS[@]}") | ||
| local _orig_comp_cword=$COMP_CWORD | ||
|
|
||
| # Get the expanded word the current command | ||
| expansion="${commands[$1]}" | ||
|
|
||
| # Split on IFS whitespace into words | ||
| read -r -a _exp_words <<<"$expansion" | ||
|
|
||
| # Inject expansion words in place of the alias | ||
| COMP_WORDS=("${_exp_words[@]}" "${COMP_WORDS[@]:1}") | ||
|
|
||
| # Only bump COMP_CWORD by 1 if the expansion is multi-word, otherwise leave it. | ||
| if [[ ${#_exp_words[@]} -gt 1 ]]; then | ||
| COMP_CWORD=$((COMP_CWORD + 1)) | ||
| fi | ||
|
|
||
| # Call the original completion function | ||
| _molecule_completion molecule | ||
|
|
||
| # Restore original words | ||
| COMP_WORDS=("${_orig_comp_words[@]}") | ||
| COMP_CWORD=$_orig_comp_cword | ||
| } | ||
|
|
||
| complete -o nosort -F _omb_completion_molecule mol | ||
| complete -o nosort -F _omb_completion_molecule mhlp | ||
| complete -o nosort -F _omb_completion_molecule mchk | ||
| complete -o nosort -F _omb_completion_molecule mcln | ||
| complete -o nosort -F _omb_completion_molecule mcnv | ||
| complete -o nosort -F _omb_completion_molecule mcrt | ||
| complete -o nosort -F _omb_completion_molecule mdep | ||
| complete -o nosort -F _omb_completion_molecule mdes | ||
| complete -o nosort -F _omb_completion_molecule mdrv | ||
| complete -o nosort -F _omb_completion_molecule midm | ||
| complete -o nosort -F _omb_completion_molecule minit | ||
| complete -o nosort -F _omb_completion_molecule mlst | ||
| complete -o nosort -F _omb_completion_molecule mlgn | ||
| complete -o nosort -F _omb_completion_molecule mtrx | ||
| complete -o nosort -F _omb_completion_molecule mprp | ||
| complete -o nosort -F _omb_completion_molecule mrst | ||
| complete -o nosort -F _omb_completion_molecule msef | ||
| complete -o nosort -F _omb_completion_molecule msyn | ||
| complete -o nosort -F _omb_completion_molecule mtest | ||
| complete -o nosort -F _omb_completion_molecule mvrf | ||
| fi |
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 was deleted.
Oops, something went wrong.
This file was deleted.
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.
Uh oh!
There was an error while loading. Please reload this page.