Skip to content

Commit

Permalink
Fix defaulting
Browse files Browse the repository at this point in the history
  • Loading branch information
cantino committed Nov 3, 2022
1 parent 6eb5c03 commit 78a5422
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mcfly.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [[ -t 0 ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then

# Populate McFly's temporary, per-session history file from recent commands in the shell's primary HISTFILE.
if [[ ! -f "${MCFLY_HISTORY}" ]]; then
MCFLY_HISTORY=$(mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
MCFLY_HISTORY=$(mktemp ${TMPDIR:-/tmp}/mcfly.XXXXXXXX)
export MCFLY_HISTORY
command tail -n100 "${HISTFILE}" >| "${MCFLY_HISTORY}"
fi
Expand Down
6 changes: 5 additions & 1 deletion mcfly.fish
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ if test "$__MCFLY_LOADED" != "loaded"
# If this is an interactive shell, set up key binding functions.
if status is-interactive
function __mcfly-history-widget -d "Search command history with McFly"
set -l mcfly_output (mktemp ${TMPDIR:/tmp}/mcfly.output.XXXXXXXX)
set tmpdir $TMPDIR
if test -z "$tmpdir"
set tmpdir /tmp
end
set -l mcfly_output (mktemp "$tmpdir/mcfly.output.XXXXXXXX")
eval $__MCFLY_CMD search -o '$mcfly_output' -- (commandline | string escape)

# Interpret commandline/run requests from McFly
Expand Down
6 changes: 3 additions & 3 deletions mcfly.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then

# McFly's temporary, per-session history file.
if [[ ! -f "${MCFLY_HISTORY}" ]]; then
export MCFLY_HISTORY=$(command mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
export MCFLY_HISTORY=$(command mktemp ${TMPDIR:-/tmp}/mcfly.XXXXXXXX)
fi

# Check if we need to use extended history
Expand All @@ -43,7 +43,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then

# Populate McFly's temporary, per-session history file from recent commands in the shell's primary HISTFILE.
if [[ ! -f "${MCFLY_HISTORY}" ]]; then
export MCFLY_HISTORY=$(command mktemp ${TMPDIR:/tmp}/mcfly.XXXXXXXX)
export MCFLY_HISTORY=$(command mktemp ${TMPDIR:-/tmp}/mcfly.XXXXXXXX)
command tail -n100 "${HISTFILE}" >| ${MCFLY_HISTORY}
fi

Expand All @@ -70,7 +70,7 @@ if [[ -o interactive ]] && [[ "$__MCFLY_LOADED" != "loaded" ]]; then
() {
echoti rmkx
exec </dev/tty
local mcfly_output=$(mktemp ${TMPDIR:/tmp}/mcfly.output.XXXXXXXX)
local mcfly_output=$(mktemp ${TMPDIR:-/tmp}/mcfly.output.XXXXXXXX)
$MCFLY_PATH --history_format $MCFLY_HISTORY_FORMAT search -o "${mcfly_output}" "${LBUFFER}"
echoti smkx

Expand Down

0 comments on commit 78a5422

Please sign in to comment.