diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2022-08-28 14:27:30 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2022-08-28 14:28:09 +0200 |
| commit | 00e24ad0909e051af8f54a982272d595a24ef7db (patch) | |
| tree | 432e6088542cb6c8f62b0348004e6178bf67e324 /functions/mark.fish | |
| parent | 507580e326066a2fe42b94ace7184b086ee6a439 (diff) | |
| download | mark-00e24ad0909e051af8f54a982272d595a24ef7db.tar.gz mark-00e24ad0909e051af8f54a982272d595a24ef7db.zip | |
extract the edit command into a function and propagate status codes
Diffstat (limited to 'functions/mark.fish')
| -rw-r--r-- | functions/mark.fish | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/functions/mark.fish b/functions/mark.fish index 2d0ab3a..bf1063b 100644 --- a/functions/mark.fish +++ b/functions/mark.fish @@ -122,6 +122,23 @@ function __mark_count --argument mark return 0 end +function __mark_edit + set store (__mark_find_store) + if test ! -z "$VISUAL" + eval $VISUAL $store + else if test ! -z "EDITOR" + eval $EDITOR $store + else if type -q "xdg-open" + xdg-open $store + else + echo "Don't know how to open marks." >&2 + echo "Please set VISUAL or EDITOR in your environment." >&2 + return 1 + end + + return $status +end + function __mark_print_usage echo "Usage: mark [cmd | <mark>] date [cmd args]" echo "Cmds:" @@ -154,17 +171,7 @@ function mark --argument cmd date case "count" __mark_count $argv[2] case "edit" "e" - set store (__mark_find_store) - if test ! -z "$VISUAL" - eval $VISUAL $store - else if test ! -z "EDITOR" - eval $EDITOR $store - else if type -q "xdg-open" - xdg-open $store - else - echo "Don't know how to open marks." - echo "Please set VISUAL or EDITOR in your environment." - end + __mark_edit case "*" set store (__mark_find_store) |
