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
2bce3b1f
Commit
2bce3b1f
authored
May 10, 2016
by
jgmdev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fossil plugin.
parent
0ebe3596
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
0 deletions
+96
-0
README.md
plugins/fossil/README.md
+7
-0
fossil.plugin.zsh
plugins/fossil/fossil.plugin.zsh
+89
-0
No files found.
plugins/fossil/README.md
0 → 100644
View file @
2bce3b1f
## Fossil Plugin
This plugin adds completion support and prompt for fossil repositories.
The prompt will display the current branch and status been dirty or clean.
### CONTRIBUTOR
-
Jefferson González (
[
jgmdev
](
https://github.com/jgmdev
)
)
plugins/fossil/fossil.plugin.zsh
0 → 100644
View file @
2bce3b1f
_FOSSIL_PROMPT
=
""
# Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_FOSSIL_PROMPT_PREFIX
=
"%{
$fg_bold
[blue]%}fossil:(%{
$fg_bold
[red]%}"
# At the very end of the prompt
ZSH_THEME_FOSSIL_PROMPT_SUFFIX
=
"%{
$fg_bold
[blue]%})"
# Text to display if the branch is dirty
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
()
{
local
_OUTPUT
=
`
fossil branch 2>&1
`
local
_STATUS
=
`
echo
$_OUTPUT
|
grep
"use --repo"
`
if
[
"
$_STATUS
"
=
""
]
;
then
local
_EDITED
=
`
fossil changes
`
local
_EDITED_SYM
=
"
$ZSH_THEME_FOSSIL_PROMPT_CLEAN
"
local
_BRANCH
=
`
echo
$_OUTPUT
|
grep
"* "
|
sed
's/* //g'
`
if
[
"
$_EDITED
"
!=
""
]
;
then
_EDITED_SYM
=
"
$ZSH_THEME_FOSSIL_PROMPT_DIRTY
"
fi
echo
"
$ZSH_THEME_FOSSIL_PROMPT_PREFIX
"
\
"
$_BRANCH
"
\
"
$ZSH_THEME_FOSSIL_PROMPT_SUFFIX
"
\
"
$_EDITED_SYM
"
\
"%{
$reset_color
%}"
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
`
if
[
"
$_FOSSIL_PROMPT
"
=
""
-o
"
$current
"
=
""
]
;
then
local
_prompt
=
${
PROMPT
}
local
_rprompt
=
${
RPROMPT
}
local
is_prompt
=
`
echo
$PROMPT
|
grep
git
`
if
[
"
$is_prompt
"
=
""
]
;
then
export
RPROMPT
=
"
$_rprompt
"
'$(fossil_prompt_info)'
else
export
PROMPT
=
"
$_prompt
"
'$(fossil_prompt_info) '
fi
_FOSSIL_PROMPT
=
"1"
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