From ba8a7f1c648a31ae906885a8a7de32505dd70fe8 Mon Sep 17 00:00:00 2001 From: LangLangbart <92653266+LangLangBart@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:00:24 +0100 Subject: [PATCH] feat: add examples to empty history file --- gh-find-code | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gh-find-code b/gh-find-code index 6d6aa4b..885cf5c 100755 --- a/gh-find-code +++ b/gh-find-code @@ -267,6 +267,14 @@ if [[ $(command column -t <<<"A Z" 2>/dev/null) != *" "* ]]; then die "Your 'column' command does not separate columns with at least two spaces. Please report this issue, stating your operating system and 'column' version." fi +# If the history file is empty and MAX_LINES_HISTORY is greater than zero, add some examples. +if [[ ! -s $gh_find_code_history ]] && ((MAX_LINES_HISTORY)); then + cat <<'EOF' >"$gh_find_code_history" +repo:junegunn/fzf FZF_PORT +extension:rs "Hello, world!" +EOF +fi + # ===================== helper functions ========================== # send a POST request to fzf