check if project name was empty
This commit is contained in:
parent
cce440353e
commit
ce97b7efa9
1 changed files with 11 additions and 7 deletions
|
@ -34,14 +34,18 @@ define-command -hidden fzf-project %{ evaluate-commands %sh{
|
||||||
}}
|
}}
|
||||||
|
|
||||||
define-command -hidden fzf-save-path-as-project %{ prompt -shell-script-candidates %{printf "%s\n" "${PWD##*/}"} "Project's name: " %{ evaluate-commands %sh{
|
define-command -hidden fzf-save-path-as-project %{ prompt -shell-script-candidates %{printf "%s\n" "${PWD##*/}"} "Project's name: " %{ evaluate-commands %sh{
|
||||||
mkdir -p "${kak_opt_fzf_project_file%/*}"
|
if [ -n "${kak_text}" ]; then
|
||||||
exists=$(grep "${kak_text}: " ${kak_opt_fzf_project_file})
|
mkdir -p "${kak_opt_fzf_project_file%/*}"
|
||||||
if [ -z "${exists}" ]; then
|
exists=$(grep "${kak_text}: " ${kak_opt_fzf_project_file})
|
||||||
[ "${kak_opt_fzf_project_use_tilda}" = "false" ] && project_path=$(pwd) || project_path=$(pwd | perl -pe "s(${HOME})(~)")
|
if [ -z "${exists}" ]; then
|
||||||
printf "%s: %s\n" "${kak_text}" "${project_path}" >> ${kak_opt_fzf_project_file}
|
[ "${kak_opt_fzf_project_use_tilda}" = "false" ] && project_path=$(pwd) || project_path=$(pwd | perl -pe "s(${HOME})(~)")
|
||||||
printf "%s\n" "echo -markup %{{Information}saved '$(pwd)' project as '${kak_text}'}"
|
printf "%s: %s\n" "${kak_text}" "${project_path}" >> ${kak_opt_fzf_project_file}
|
||||||
|
printf "%s\n" "echo -markup %{{Information}saved '$(pwd)' project as '${kak_text}'}"
|
||||||
|
else
|
||||||
|
printf "%s\n" "fzf-project-confirm-impl %{Project '${kak_text}' exists. Update? (y/N): } %{fzf-update-project-path-impl %{${kak_text}} %{${PWD}}} %{Project '${kak_text}' updated} %{Project '${kak_text}' kept}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf "%s\n" "fzf-project-confirm-impl %{Project '${kak_text}' exists. Update? (y/N): } %{fzf-update-project-path-impl %{${kak_text}} %{${PWD}}} %{Project '${kak_text}' updated} %{Project '${kak_text}' kept}"
|
printf "%s\n" "echo -markup %{{Error} Project name can't be empty}"
|
||||||
fi
|
fi
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue