Commit 97b6b92c authored by Stephen M. Coakley's avatar Stephen M. Coakley Committed by GitHub

Merge pull request #618 from oranja/609-installer-no-carets

Use posix stderr redirection (`2>` instead of `^`)
parents 5bd4a41d a6a67be6
......@@ -42,7 +42,7 @@ fish install --path=~/.local/share/omf --config=~/.config/omf
You can verify the integrity of the downloaded installer by verifying the script against [this checksum](bin/install.sha256):
```
06844ca6876fac0ea949c8089d8c5f71e14b69d2bb1dc41f1d0677250a1c62e1 install
434264c56e3a7bb74733d9b293d72403c404e0a0bded3e632433d391d302504e install
```
You can also install Oh My Fish with Git or with an offline source tarball downloaded from the [releases page][releases]:
......
......@@ -186,7 +186,7 @@ function install_from_github
if test $OMF_CHANNEL = stable
# Get the commit for the latest release.
set -l hash (command git --git-dir "$OMF_PATH/.git" --work-tree "$OMF_PATH" rev-list --tags='v*' --max-count=1 ^ /dev/null)
set -l hash (command git --git-dir "$OMF_PATH/.git" --work-tree "$OMF_PATH" rev-list --tags='v*' --max-count=1 2> /dev/null)
# Get the release tag.
and set -l tag (command git --git-dir "$OMF_PATH/.git" --work-tree "$OMF_PATH" describe --tags $hash)
# Checkout the release.
......@@ -365,11 +365,11 @@ function uninstall_omf
is_install_dir "$OMF_PATH"
or abort "No installation detected at $OMF_PATH"
say (set_color -o red ^ /dev/null)"This will uninstall Oh My Fish and all plugins and themes from $OMF_PATH."(set_color normal ^ /dev/null)
say (set_color -o red 2> /dev/null)"This will uninstall Oh My Fish and all plugins and themes from $OMF_PATH."(set_color normal 2> /dev/null)
# If we installed the bootstrap to the user's config, let them know they need to remove it themselves.
if begin; test -f "$FISH_CONFIG/config.fish"; and grep -q OMF_PATH "$FISH_CONFIG/config.fish"; end
say (set_color -o ^ /dev/null)"Your configuration will not be modified. You may need to remove Oh My Fish startup code from $FISH_CONFIG/config.fish."(set_color normal ^ /dev/null)
say (set_color -o 2> /dev/null)"Your configuration will not be modified. You may need to remove Oh My Fish startup code from $FISH_CONFIG/config.fish."(set_color normal 2> /dev/null)
end
confirm_yes "Are you sure you want to continue?"
......@@ -420,7 +420,7 @@ function backup_file -a file_path
say "Existent $file found at $path"
say "↳ Moving to $backup_file"
if not command cp "$file_path" $backup_file ^/dev/null
if not command cp "$file_path" $backup_file 2> /dev/null
abort "Could not backup $file_path"
end
......@@ -441,7 +441,7 @@ function restore_backup_file -a file_path
if confirm "Would you like to restore it (overwrite existing)?"
say "Restoring backup file to $path/$file"
command mv "$backup_file_path" "$path/$file" ^/dev/null
command mv "$backup_file_path" "$path/$file" 2> /dev/null
or abort "Could not restore backup $backup_file_path"
end
end
......@@ -467,7 +467,7 @@ function sane_environment_check
or abort (which sort)" is not a sane 'sort' implementation"
debug "Checking for a working AWK interpreter"
cmd awk 'BEGIN{exit 42;}' < /dev/null ^ /dev/null
cmd awk 'BEGIN{exit 42;}' < /dev/null 2> /dev/null
if not test $status -eq 42
abort (which awk)" does not look like an AWK interpreter."
end
......@@ -501,7 +501,7 @@ end
# Gets the version of Git installed.
function get_git_version
type -f git > /dev/null ^ /dev/null
type -f git > /dev/null 2> /dev/null
and command git --version | command cut -d' ' -f3
end
......@@ -516,7 +516,7 @@ end
# Checks if OMF is set up properly and working.
function is_omf_loaded
command fish -c "omf --version" > /dev/null ^&1
command fish -c "omf --version" > /dev/null 2>&1
end
......@@ -561,7 +561,7 @@ function assert_cmds
set -l cmds awk basename cp cut date dirname env fish fold head mkdir mv readlink rm sed sort tar tr which
for cmd in $cmds
type -f $cmd > /dev/null ^ /dev/null
type -f $cmd > /dev/null 2> /dev/null
or abort "Missing required command: $cmd"
debug "Command '$cmd' is "(which $cmd)
......@@ -575,14 +575,14 @@ function assert_interactive
and return
test -c /dev/tty -a -r /dev/tty
and echo -n > /dev/tty ^ /dev/null
and echo -n > /dev/tty 2> /dev/null
or abort "Running interactively, but can't read from tty (try running with --noninteractive)"
end
# A link-following `which` wrapper.
function which
if type realpath > /dev/null ^ /dev/null
if type realpath > /dev/null 2> /dev/null
realpath (command which $argv)
else
command readlink (command which $argv)
......@@ -595,7 +595,7 @@ function cmd
if set -q VERBOSE
command env $argv
else
command env $argv ^ /dev/null
command env $argv 2> /dev/null
end
end
......@@ -621,9 +621,9 @@ function abort -a message code
end
if test -n "$message"
printf "%sInstall aborted: $message%s\n" (set_color -o red ^ /dev/null) (set_color normal ^ /dev/null) >&2
printf "%sInstall aborted: $message%s\n" (set_color -o red 2> /dev/null) (set_color normal 2> /dev/null) >&2
else
printf "%sInstall aborted%s\n" (set_color -o red ^ /dev/null) (set_color normal ^ /dev/null) >&2
printf "%sInstall aborted%s\n" (set_color -o red 2> /dev/null) (set_color normal 2> /dev/null) >&2
end
exit $code
......@@ -640,7 +640,7 @@ function confirm -a message
set -q NONINTERACTIVE
and return 1
printf "%s$message (y/N): %s" (set_color yellow ^ /dev/null) (set_color normal ^ /dev/null)
printf "%s$message (y/N): %s" (set_color yellow 2> /dev/null) (set_color normal 2> /dev/null)
read -l answer < /dev/tty
or abort "Failed to read from tty"
......
06844ca6876fac0ea949c8089d8c5f71e14b69d2bb1dc41f1d0677250a1c62e1 install
434264c56e3a7bb74733d9b293d72403c404e0a0bded3e632433d391d302504e install
......@@ -5,7 +5,7 @@ if not set -q OMF_CONFIG
end
# Source custom before.init.fish file
test -f $OMF_CONFIG/before.init.fish
and source $OMF_CONFIG/before.init.fish ^/dev/null
and source $OMF_CONFIG/before.init.fish 2> /dev/null
emit perf:timer:start "Oh My Fish initialisation"
# Read current theme
test -f $OMF_CONFIG/theme
......
function git_ahead -a ahead behind diverged none
not git_is_repo; and return
set -l commit_count (command git rev-list --count --left-right "@{upstream}...HEAD" ^/dev/null)
set -l commit_count (command git rev-list --count --left-right "@{upstream}...HEAD" 2> /dev/null)
switch "$commit_count"
case ""
......
function git_branch_name -d "Get current branch name"
git_is_repo; and begin
command git symbolic-ref --short HEAD ^/dev/null;
or command git show-ref --head -s --abbrev | head -n1 ^/dev/null
command git symbolic-ref --short HEAD 2> /dev/null;
or command git show-ref --head -s --abbrev | head -n1 2> /dev/null
end
end
function git_is_repo -d "Check if directory is a repository"
test -d .git; or command git rev-parse --git-dir >/dev/null ^/dev/null
test -d .git; or command git rev-parse --git-dir >/dev/null 2> /dev/null
end
......@@ -13,7 +13,7 @@ function fish-spec
end
# Load helper file
source spec/helper.fish ^/dev/null
source spec/helper.fish 2> /dev/null
emit all_specs_init
......
......@@ -8,7 +8,7 @@ function omf.bundle.add -a type name_or_url
set -l record "$type $name_or_url"
if test -f $bundle
if not grep $record $bundle > /dev/null ^&1
if not grep $record $bundle > /dev/null 2>&1
echo $record >> $bundle
end
else
......
......@@ -13,10 +13,10 @@ function omf.cli.help
set doc $doc_root/$command.adoc
end
set -l r (set_color normal ^ /dev/null)
set -l c (set_color cyan ^ /dev/null)
set -l b (set_color --bold ^ /dev/null)
set -l u (set_color --underline ^ /dev/null)
set -l r (set_color normal 2> /dev/null)
set -l c (set_color cyan 2> /dev/null)
set -l b (set_color --bold 2> /dev/null)
set -l u (set_color --underline 2> /dev/null)
# Format the help document for the terminal.
fold -s -w 78 $doc | sed -e "
......
function omf.cli.reload
if not contains -- --force $argv
if count (jobs) >/dev/null ^&1
if count (jobs) >/dev/null 2>&1
__omf.cli.reload.job_warning
return 1
end
......
......@@ -4,10 +4,10 @@ function omf.core.update
# If the channel isn't explicitly set and we are currently tracking a branch instead of a version, the user probably
# upgraded from an old version. Let them know that we will start updating to stable versions.
if begin; not test -f $OMF_CONFIG/channel; and command git -C "$OMF_PATH" symbolic-ref -q HEAD > /dev/null; end
set_color yellow --bold ^ /dev/null
set_color yellow --bold 2> /dev/null
echo ">> You have been switched to the stable release channel of Oh My Fish."
echo ">> To switch back to the development channel, run `omf channel dev`."
set_color normal ^ /dev/null
set_color normal 2> /dev/null
end
# Determine the remote to fetch from.
......@@ -19,7 +19,7 @@ function omf.core.update
# Fetch the latest tags.
command git -C "$OMF_PATH" fetch --quiet --tags $remote
# Get the commit for the latest release.
and set -l hash (command git -C "$OMF_PATH" rev-list --tags='v*' --max-count=1 ^ /dev/null)
and set -l hash (command git -C "$OMF_PATH" rev-list --tags='v*' --max-count=1 2> /dev/null)
# Get the release tag.
and set -l tag (command git -C "$OMF_PATH" describe --tags $hash)
# Checkout the release.
......
......@@ -46,7 +46,7 @@ function omf.index.repositories -d 'Manage package repositories'
end
# Before we add, do a quick ls-remote to see if the URL is a valid repo.
if not command git ls-remote --exit-code $repo_url refs/heads/$repo_branch > /dev/null ^&1
if not command git ls-remote --exit-code $repo_url refs/heads/$repo_branch > /dev/null 2>&1
echo "The remote repository could not be found." >&2
return 1
end
......
......@@ -35,7 +35,7 @@ function __omf.packages.new.from_template -a path github user name
end)$target
end
end
popd >/dev/null ^&1
popd >/dev/null 2>&1
end
......
......@@ -17,7 +17,7 @@ function omf.packages.remove -a pkg
# Run uninstall hook first.
omf.packages.run_hook $path uninstall
source $path/uninstall.fish ^/dev/null;
source $path/uninstall.fish 2> /dev/null;
and emit uninstall_$pkg
if rm -rf $path
......
......@@ -3,7 +3,7 @@ function omf.check.fish_prompt
set -l theme (cat $OMF_CONFIG/theme)
set -l user_functions_path (omf.xdg.config_home)/fish/functions
set -l fish_prompt (readlink "$user_functions_path/$prompt_file" ^/dev/null)
set -l fish_prompt (readlink "$user_functions_path/$prompt_file" 2> /dev/null)
not test -e "$fish_prompt"; and return 0
contains -- "$fish_prompt" {$OMF_CONFIG,$OMF_PATH}/themes/$theme/$prompt_file
......
......@@ -4,23 +4,23 @@ set -g OMF_INVALID_ARG 3
set -g OMF_UNKNOWN_ERR 4
function omf::em
set_color cyan ^ /dev/null
set_color cyan 2> /dev/null
end
function omf::dim
set_color 555 ^ /dev/null
set_color 555 2> /dev/null
end
function omf::err
set_color red --bold ^ /dev/null
set_color red --bold 2> /dev/null
end
function omf::under
set_color --underline ^ /dev/null
set_color --underline 2> /dev/null
end
function omf::off
set_color normal ^ /dev/null
set_color normal 2> /dev/null
end
autoload $path/functions/{compat,core,index,packages,themes,bundle,util,repo,cli,search}
......@@ -14,7 +14,7 @@ function describe_basic_tests
end
function it_install_packages
set -l remove_output (omf remove apt ^/dev/null)
set -l remove_output (omf remove apt 2> /dev/null)
set -l install_output (omf install apt)
assert 0 = $status
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment