Skip to content

Commit

Permalink
rename pure_user_host_location as `pure_prompt_begin_with_current_d…
Browse files Browse the repository at this point in the history
…irectory`
  • Loading branch information
edouard-lopez committed Jan 2, 2019
1 parent 96c7abe commit 731a406
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ _pure_set_default pure_username_color $pure_color_gray
_pure_set_default pure_host_color $pure_color_gray
_pure_set_default pure_root_color $pure_color_normal
# Determines whether the username and host are shown at the begining or end
# 0 - end of prompt, default
# 1 - start of prompt
# Any other value defaults to the default behaviour
_pure_set_default pure_user_host_location 0
# Print current working directory at the beginning of prompt
# true (default): current directory, git, user@hostname (ssh-only), command duration
# false: user@hostname (ssh-only), current directory, git, command duration
_pure_set_default pure_prompt_begin_with_current_directory true
# Show exit code of last command as a separate prompt character (cf. https://github.com/sindresorhus/pure/wiki#show-exit-code-of-last-command-as-a-separate-prompt-character)
# false - single prompt character, default
Expand Down
9 changes: 4 additions & 5 deletions conf.d/pure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ _pure_set_default pure_username_color $pure_color_gray
_pure_set_default pure_host_color $pure_color_gray
_pure_set_default pure_root_color $pure_color_normal

# Determines whether the username and host are shown at the begining or end
# 0 - end of prompt, default
# 1 - start of prompt
# Any other value defaults to the default behaviour
_pure_set_default pure_user_host_location 0
# Print current working directory at the beginning of prompt
# true (default): current directory, git, user@hostname (ssh-only), command duration
# false: user@hostname (ssh-only), current directory, git, command duration
_pure_set_default pure_prompt_begin_with_current_directory true

# Show exit code of last command as a separate prompt character (cf. https://github.com/sindresorhus/pure/wiki#show-exit-code-of-last-command-as-a-separate-prompt-character)
# false - single prompt character, default
Expand Down
4 changes: 2 additions & 2 deletions functions/_pure_prompt_first_line.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function _pure_prompt_first_line \
--description 'Print contextual information before prompt.'

if not type -fq git # exit if git is not available
return 1
end
Expand All @@ -14,7 +14,7 @@ function _pure_prompt_first_line \
set --local current_folder (_pure_prompt_current_folder $prompt_width)

set --local prompt_components
if test $pure_user_host_location -eq 0
if test $pure_prompt_begin_with_current_directory = true
set prompt_components \
(_pure_prompt_current_folder $prompt_width) \
(_pure_prompt_git) \
Expand Down
8 changes: 4 additions & 4 deletions tests/_pure_prompt_first_line.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test "fails when git is missing"
) = 1
end

test "print first line as: current directory, git, user@hostname, command duration"
test "print first line as: current directory, git, user@hostname (ssh-only), command duration"
(
set pure_color_blue $EMPTY
set pure_color_gray $EMPTY
Expand All @@ -37,14 +37,14 @@ test "print first line as: current directory, git, user@hostname, command durati
echo 'user@hostname'
end

set pure_user_host_location 0
set pure_prompt_begin_with_current_directory true
_pure_prompt_first_line

rm --recursive --force /tmp/test
) = '/tmp/test master user@hostname 1s'
end

test "print first line as: user@hostname, current directory, git, command duration"
test "print first line as: user@hostname (ssh-only), current directory, git, command duration"
(
set pure_color_blue $EMPTY
set pure_color_gray $EMPTY
Expand All @@ -60,7 +60,7 @@ test "print first line as: user@hostname, current directory, git, command durati
echo 'user@hostname'
end

set pure_user_host_location 1
set pure_prompt_begin_with_current_directory false
_pure_prompt_first_line

rm --recursive --force /tmp/test
Expand Down

0 comments on commit 731a406

Please sign in to comment.