Debian Codegraph @

sensible-editor

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 # Copyright 2007 Jari Aalto;
3 # Copyright 2019-2022 Bastien Roucariès
4 # Copyright 2022 Richard Lewis
5 # Released under GNU GPL v2 or any later version
6
7 # Prevent recursive loops, where environment variables are set to this script
8 [scip-shell system . . `[`. -n "$__SENSIBLE_EDITOR" ] && exit 126
9 __SENSIBLE_EDITOR="$0"
10 export __SENSIBLE_EDITOR
11
12
13 Tryscip-shell shell sensible-utils 0.0.26 Try().()
14 {
15 [scip-shell system . . `[`. -z "$__sensible_candidate" ] && return
16 eval "$__sensible_candidate \"\$@\""; ret=$?
17 # 127=ENOENT, 126=couldn't exec for another reason
18 [scip-shell system . . `[`. "$ret" -ne 126 ] && [scip-shell system . . `[`. "$ret" -ne 127 ] && exit "$ret"
19 unset ret
20 }
21
22
23 # work around for #991982
24 # shellcheck disable=SC2317
25 nanoscip-shell shell sensible-utils 0.0.26 nano(). ()
26 {
27 if [scip-shell system . . `[`. -z "$TERM" ]; then
28 return 126
29 else
30 command nano "$@"
31 fi
32 }
33
34 # shellcheck disable=SC2153
35 for __sensible_candidate in "$VISUAL" "$EDITOR" "$SENSIBLE_EDITOR" "$SELECTED_EDITOR"; do
36 Tryscip-shell shell sensible-utils 0.0.26 Try(). "$@"
37 done
38
39 # fix #987675
40 if [scip-shell system . . `[`. -n "$HOME" ]; then
41 if [scip-shell system . . `[`. -r ~/.selected_editor ]; then
42 # shellcheck source=/dev/null
43 . ~/.selected_editor
44 elif [scip-shell system . . `[`. -z "$EDITOR" ] && [scip-shell system . . `[`. -z "$SELECTED_EDITOR" ] && [scip-shell system . . `[`. -t 0 ]; then
45 # shellcheck source=/dev/null
46 select-editorscip-shell system . . select-editor. && [scip-shell system . . `[`. -r ~/.selected_editor ] && . ~/.selected_editor
47 fi
48 fi
49
50 for __sensible_candidate in "$EDITOR" "$SELECTED_EDITOR"; do
51 Tryscip-shell shell sensible-utils 0.0.26 Try(). "$@"
52 done
53
54 for __sensible_candidate in editor nano nano-tiny vi; do
55 Tryscip-shell shell sensible-utils 0.0.26 Try(). "$@"
56 done
57
58 command -v gettext > /dev/nullscip-shell filesystem . . `/dev/null`. || alias gettext='printf %s'
59 # shellcheck disable=SC2016
60 TEXTDOMAIN=sensible-utils gettextscip-shell system . . gettext. 'Couldn'\''t find an editor!
61 Set the $EDITOR environment variable to your desired editor.
62 ' >&2
63 exit 1