Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
7df7d5b4
Unverified
Commit
7df7d5b4
authored
Dec 28, 2021
by
CGenie
Committed by
GitHub
Dec 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(fossil): add completion for `fossil add` (#8564)
Co-authored-by:
Marc Cornellà
<
hello@mcornella.com
>
parent
1d6553e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
35 deletions
+33
-35
_fossil
plugins/fossil/_fossil
+32
-0
fossil.plugin.zsh
plugins/fossil/fossil.plugin.zsh
+1
-35
No files found.
plugins/fossil/_fossil
0 → 100644
View file @
7df7d5b4
#compdef fossil
function _fossil_get_command_list () {
fossil help -a | grep -v "Usage|Common|This is"
}
function _fossil () {
local context state state_descr line
typeset -A opt_args
_arguments \
'1: :->command'\
'2: :->subcommand'
case $state in
command)
local _OUTPUT=$(fossil branch 2>&1 | grep "use --repo")
if [[ -z "$_OUTPUT" ]]; then
compadd "$(_fossil_get_command_list)"
else
compadd clone init import help version
fi ;;
subcommand)
case "$words[2]" in
help) compadd "$(_fossil_get_command_list)" ;;
add) compadd "$(fossil extra)" ;;
*) compcall -D ;;
esac ;;
esac
}
_fossil "$@"
plugins/fossil/fossil.plugin.zsh
View file @
7df7d5b4
...
...
@@ -12,7 +12,7 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
# Text to display if the branch is clean
ZSH_THEME_FOSSIL_PROMPT_CLEAN
=
" %{
$fg_bold
[green]%}✔"
function
fossil_prompt_info
()
{
function
fossil_prompt_info
()
{
local
_OUTPUT
=
`
fossil branch 2>&1
`
local
_STATUS
=
`
echo
$_OUTPUT
|
grep
"use --repo"
`
if
[
"
$_STATUS
"
=
""
]
;
then
...
...
@@ -32,37 +32,6 @@ function fossil_prompt_info () {
fi
}
function
_fossil_get_command_list
()
{
fossil
help
-a
|
grep
-v
"Usage|Common|This is"
}
function
_fossil
()
{
local
context state state_descr line
typeset
-A
opt_args
_arguments
\
'1: :->command'
\
'2: :->subcommand'
case
$state
in
command
)
local
_OUTPUT
=
`
fossil branch 2>&1 |
grep
"use --repo"
`
if
[
"
$_OUTPUT
"
=
""
]
;
then
compadd
`
_fossil_get_command_list
`
else
compadd clone init import
help
version
fi
;;
subcommand
)
if
[
"
$words
[2]"
=
"help"
]
;
then
compadd
`
_fossil_get_command_list
`
else
compcall
-D
fi
;;
esac
}
function
_fossil_prompt
()
{
local
current
=
`
echo
$PROMPT
$RPROMPT
|
grep
fossil
`
...
...
@@ -82,8 +51,5 @@ function _fossil_prompt () {
fi
}
compdef _fossil fossil
autoload
-U
add-zsh-hook
add-zsh-hook precmd _fossil_prompt
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment