~ane/web

94f642b3491019f35cf85d2b5fc110ce6b7a92af — Antoine Kalmbach 1 year, 11 months ago a4efd51
ffs
1 files changed, 0 insertions(+), 17 deletions(-)

M _posts/2022-06-20-beenthere-donethat.md
M _posts/2022-06-20-beenthere-donethat.md => _posts/2022-06-20-beenthere-donethat.md +0 -17
@@ 55,23 55,6 @@ prompting. You can have bt and dt too, just dump this into your `.bash_profile`:
``` shell
bt() {
    if [[ -z "$1" ]]; then
        CMD=$(history | fzf --header="Choose a command to save" --no-sort --tac | cut -d' ' -f 5-)
    else
        CMD=$1
    fi

    [[ -z "$CMD" ]] && echo "Aborted" && return 2
    echo "Saving \"${CMD}\"..."
    read -p "Name this command: " NAME
    [[ -z "$NAME" ]] && echo "No name given, aborting" && return 1
    LONG=$(read -p "Longer description (optional): ")
    DATA="${BTDT_DATA:-${HOME}/.config/btdt/data}"

    result="${CMD}\t${NAME}\t${LONG}\n"
    printf "$result" >> $DATA
}
bt() {
    if [[ -z "$1" ]]; then
        CMD=$(history 10 | fzf --header="Choose a command to save" --no-sort --tac | cut -d' ' -f 5-)
    else
        CMD=$1