-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add newline support #162
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,7 @@ MCFLY_SESSION_ID="$(command dd if=/dev/urandom bs=256 count=1 2> /dev/null | LC_ | |
export MCFLY_SESSION_ID | ||
|
||
# Find the binary | ||
MCFLY_PATH=${MCFLY_PATH:-$(which mcfly)} | ||
if [ -z "$MCFLY_PATH" ]; then | ||
if [ -z "$(which mcfly)" ]; then | ||
echo "Cannot find the mcfly binary, please make sure that mcfly is in your path before sourcing mcfly.bash." | ||
return 1 | ||
fi | ||
|
@@ -44,15 +43,11 @@ function mcfly_prompt_command { | |
command tail -n100 "${HISTFILE}" >| "${MCFLY_HISTORY}" | ||
fi | ||
|
||
history -a "${MCFLY_HISTORY}" # Append history to $MCFLY_HISTORY. | ||
# Run mcfly with the saved code. It will: | ||
# * append commands to $HISTFILE, (~/.bash_history by default) | ||
# for backwards compatibility and to load in new terminal sessions; | ||
# * find the text of the last command in $MCFLY_HISTORY and save it to the database. | ||
$MCFLY_PATH add --exit ${exit_code} --append-to-histfile | ||
# Clear the in-memory history and reload it from $MCFLY_HISTORY | ||
# (to remove instances of '#mcfly: ' from the local session history). | ||
history -cr "${MCFLY_HISTORY}" | ||
# Run mcfly with the last history entry on stdin. It will: | ||
# * Append the command to $HISTFILE, (~/.bash_history by default) | ||
# * Parse out the command and and save it to the database. | ||
HISTTIMEFORMAT="%s:" history 1 | mcfly add --exit $exit_code --command-from-stdin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this still work on bash <4? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the bash release notes, |
||
|
||
return ${exit_code} # Restore the original exit code by returning it. | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was definitely a reason for $MCFLY_PATH to exist, but I can't recall anymore what it was.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leave it out then? I can't find anything that reads it, just things setting it in the dev.* scripts.