diff --git a/README.md b/README.md index 369bf1c..94e2c85 100644 --- a/README.md +++ b/README.md @@ -156,8 +156,8 @@ $ pretty-git-prompt create-default-config This repository contains also configuration for bash and zsh with colors: -1. `files/pretty-git-prompt.yml.bash` -2. `files/pretty-git-prompt.yml.zsh` +1. [`files/pretty-git-prompt.yml.bash`](https://github.com/TomasTomecek/pretty-git-prompt/blob/master/files/pretty-git-prompt.yml.bash) +2. [`files/pretty-git-prompt.yml.zsh`](https://github.com/TomasTomecek/pretty-git-prompt/blob/master/files/pretty-git-prompt.yml.zsh) In case anything is not clear from the comments inside the config files, please open a new issue. diff --git a/files/pretty-git-prompt.yml.bash b/files/pretty-git-prompt.yml.bash index b663cd5..cec8e10 100644 --- a/files/pretty-git-prompt.yml.bash +++ b/files/pretty-git-prompt.yml.bash @@ -1,26 +1,41 @@ +# version of configuration file +# right now it needs to be set to '1' version: '1' # configuration of various values (required), type dict # if you omit a value, it won't be displayed values: # count of untracked files new: + # formatting (required), both (pre_format, post_format) are required + # you can include coloring in pre_format and reset colors in post_format + # you can also include arbitrary string + # for more information about setting colors for bash and zsh: # https://wiki.archlinux.org/index.php/zsh#Colors # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects # https://www.ibm.com/developerworks/linux/library/l-tip-prompt/ + # this is how the value is formatted in the end: + # [pre_format][value][post_format] + # example: + # ✚2 pre_format: '\[\e[38;5;248m\]✚' post_format: '\[\e[0m\]' + # the number of tracked files which were changed in working tree changed: pre_format: '\[\e[38;5;166m\]Δ' post_format: '\[\e[0m\]' + # the number of files added to index staged: pre_format: '\[\e[38;5;2m\]▶' post_format: '\[\e[0m\]' + # during merge, rebase, or others, the numbers files which conflict conflicts: pre_format: '\[\e[38;5;226m\]✖' post_format: '\[\e[0m\]' + # the number of files present locally which are missing in remote repo difference_ahead: pre_format: '\[\e[38;5;7m\]↑' post_format: '\[\e[0m\]' + # the number of commits present in remote repo which are missing locally difference_behind: pre_format: '\[\e[38;5;7m\]↓' post_format: '\[\e[0m\]' @@ -28,10 +43,6 @@ values: # monitor status against different remotes (optional), type dict # track history divergence monitor_remotes: - # formatting (required), both are required - # this is displayed as: '[pre_format][value][post_format]' - # include coloring in pre_format and reset colors in post_format - # you can also include arbitrary string # there are some special values which are substituted: # * will be replaced with name of a remote # * will be replaced with current branch name @@ -39,7 +50,7 @@ monitor_remotes: - pre_format: '\[\e[38;5;4m\]' post_format: '\[\e[0m\]' # remote branch name (optional), type string - # example: 'upstream/mater' + # example: 'upstream/master' # if omitted look for remotely tracked branch usualy set up with: # git branch --set-upstream-to # remote_branch: '' diff --git a/files/pretty-git-prompt.yml.zsh b/files/pretty-git-prompt.yml.zsh index 38e8ac5..895d38a 100644 --- a/files/pretty-git-prompt.yml.zsh +++ b/files/pretty-git-prompt.yml.zsh @@ -1,26 +1,41 @@ +# version of configuration file +# right now it needs to be set to '1' version: '1' # configuration of various values (required), type dict # if you omit a value, it won't be displayed values: # count of untracked files new: + # formatting (required), both (pre_format, post_format) are required + # you can include coloring in pre_format and reset colors in post_format + # you can also include arbitrary string + # for more information about setting colors for bash and zsh: # https://wiki.archlinux.org/index.php/zsh#Colors # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects # https://www.ibm.com/developerworks/linux/library/l-tip-prompt/ + # this is how the value is formatted in the end: + # [pre_format][value][post_format] + # example: + # ✚2 pre_format: '%{%F{014}%}✚' post_format: '%{%f%}' + # the number of tracked files which were changed in working tree changed: pre_format: '%{%B%F{red}%}Δ' post_format: '%{%b%f%}' + # the number of files added to index staged: pre_format: '%{%F{green}%}▶' post_format: '%{%f%}' + # during merge, rebase, or others, the numbers files which conflict conflicts: pre_format: '%{%F{yellow}%}✖' post_format: '%{%f%}' + # the number of files present locally which are missing in remote repo difference_ahead: pre_format: '%{%F{white}%}↑' post_format: '%{%f%}' + # the number of commits present in remote repo which are missing locally difference_behind: pre_format: '%{%F{white}%}↓' post_format: '%{%f%}' @@ -28,10 +43,6 @@ values: # monitor status against different remotes (optional), type dict # track history divergence monitor_remotes: - # formatting (required), both are required - # this is displayed as: '[pre_format][value][post_format]' - # include coloring in pre_format and reset colors in post_format - # you can also include arbitrary string # there are some special values which are substituted: # * will be replaced with name of a remote # * will be replaced with current branch name @@ -39,7 +50,7 @@ monitor_remotes: - pre_format: '%{%F{blue}%}' post_format: '%{%f%}' # remote branch name (optional), type string - # example: 'upstream/mater' + # example: 'upstream/master' # if omitted look for remotely tracked branch usualy set up with: # git branch --set-upstream-to # remote_branch: '' diff --git a/src/conf.rs b/src/conf.rs index 4ac6196..6b94a9f 100644 --- a/src/conf.rs +++ b/src/conf.rs @@ -7,35 +7,45 @@ use constants::{get_default_config_path, CURRENT_CONFIG_VERSION}; use yaml_rust::{YamlLoader, Yaml}; -// TODO: add version and check for correct version -// TODO: polish and sync comments static DEFAULT_CONF: &'static str = "--- +# version of configuration file +# right now it needs to be set to '1' version: '1' # configuration of various values (required), type dict # if you omit a value, it won't be displayed values: # the number of untracked files new: - # formatting (required), both are required + # formatting (required), both (pre_format, post_format) are required + # you can include coloring in pre_format and reset colors in post_format + # you can also include arbitrary string + # for more information about setting colors for bash and zsh: # https://wiki.archlinux.org/index.php/zsh#Colors # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Visual-effects # https://www.ibm.com/developerworks/linux/library/l-tip-prompt/ - # This is values get formatted: + # this is how the value is formatted in the end: # [pre_format][value][post_format] + # example: + # ✚2 pre_format: '✚' post_format: '' + # the number of tracked files which were changed in working tree changed: pre_format: 'Δ' post_format: '' + # the number of files added to index staged: pre_format: '▶' post_format: '' + # during merge, rebase, or others, the numbers files which conflict conflicts: pre_format: '✖' post_format: '' + # the number of files present locally which are missing in remote repo difference_ahead: pre_format: '↑' post_format: '' + # the number of commits present in remote repo which are missing locally difference_behind: pre_format: '↓' post_format: '' @@ -43,10 +53,6 @@ values: # monitor status against different remotes (optional), type dict # track history divergence monitor_remotes: - # formatting (required), both are required - # this is displayed as: '[pre_format][value][post_format]' - # include coloring in pre_format and reset colors in post_format - # you can also include arbitrary string # there are some special values which are substituted: # * will be replaced with name of a remote # * will be replaced with current branch name @@ -54,7 +60,7 @@ monitor_remotes: - pre_format: '' post_format: '' # remote branch name (optional), type string - # example: 'upstream/mater' + # example: 'upstream/master' # if omitted look for remotely tracked branch usualy set up with: # git branch --set-upstream-to # remote_branch: ''