Browse Source

Rename binary: shellfu-get to sfpath

The only purpose of the binary is to show local Shellfu path and it's
in every single Shellfu script.  Let's save people some typing.
Alois Mahdal 6 years ago
parent
commit
32ce9930e8
38 changed files with 55 additions and 63 deletions
  1. 4
    4
      README.md
  2. 1
    1
      mkit.ini
  3. 1
    1
      packaging/debian/shellfu.install
  4. 1
    1
      packaging/template.spec
  5. 4
    4
      src/bin/sfpath.skel
  6. 2
    2
      src/bin/shellfu-doc
  7. 6
    14
      src/complete.bash
  8. 3
    3
      tests/TF_HEADER
  9. 1
    1
      tests/inigrep_chars/TF_RUN
  10. 1
    1
      tests/inigrep_inigrep/TF_RUN
  11. 1
    1
      tests/mdfmt/TF_RUN
  12. 1
    1
      tests/pretty_basic/TF_RUN
  13. 1
    1
      tests/pretty_basic/test/wrap_debug
  14. 1
    1
      tests/pretty_basic/test/wrap_die
  15. 1
    1
      tests/pretty_basic/test/wrap_mkusage
  16. 1
    1
      tests/pretty_basic/test/wrap_mkusage-subcommand
  17. 1
    1
      tests/pretty_basic/test/wrap_mkusage_0
  18. 1
    1
      tests/pretty_basic/test/wrap_mkusage_0w
  19. 1
    1
      tests/pretty_basic/test/wrap_mkusage_1
  20. 1
    1
      tests/pretty_basic/test/wrap_mkusage_2
  21. 1
    1
      tests/pretty_basic/test/wrap_mkusage_all
  22. 1
    1
      tests/pretty_basic/test/wrap_mkusage_allw
  23. 1
    1
      tests/pretty_basic/test/wrap_mkusage_c
  24. 1
    1
      tests/pretty_basic/test/wrap_mkusage_conflict
  25. 1
    1
      tests/pretty_basic/test/wrap_mkusage_i
  26. 1
    1
      tests/pretty_basic/test/wrap_mkusage_o
  27. 1
    1
      tests/pretty_basic/test/wrap_mkusage_p
  28. 1
    1
      tests/pretty_basic/test/wrap_mkusage_self
  29. 4
    4
      tests/shellfu_import/TF_RUN
  30. 1
    1
      tests/shellfu_import/test/import_fn.sh
  31. 1
    1
      tests/shellfu_import/test/import_var.sh
  32. 1
    1
      tests/shellfu_import/test/import_var_fn.sh
  33. 1
    1
      tests/shellfu_import/test/import_var_fn_bash.sh
  34. 1
    1
      tests/shellfu_import/test/import_var_fn_bash_hint.sh
  35. 1
    1
      tests/shellfu_import/test/try_import_fn.sh
  36. 1
    1
      tests/shellfu_import/test/try_import_var.sh
  37. 1
    1
      tests/shellfu_import/test/try_import_var_fn.sh
  38. 1
    1
      tests/shellfu_version/TF_RUN

+ 4
- 4
README.md View File

@@ -78,8 +78,8 @@ Usage
78 78
 
79 79
 After installing, one of the first things you can do is:
80 80
 
81
-    shellfu-get path
82
-    shellfu-get --version
81
+    sfpath
82
+    sfpath --version
83 83
 
84 84
 That should return path to *shellfu.sh* and version, respectively.
85 85
 And that's also *all* this command does.
@@ -103,7 +103,7 @@ Next, you can create your first Shellfu-Bash script:
103 103
 
104 104
     #!/usr/bin/bash
105 105
 
106
-    . "$(shellfu-get path)" || exit 3
106
+    . "$(sfpath)" || exit 3
107 107
 
108 108
     shellfu import pretty
109 109
 
@@ -124,7 +124,7 @@ Next, you can create your first Shellfu-Bash script:
124 124
 
125 125
 This is how above script works:
126 126
 
127
- 1. shellfu-get provides path to the main shellfu.sh, which defines
127
+ 1. sfpath provides path to the main shellfu.sh, which defines
128 128
     `shellfu()` function (plus a bunch of boring variables).
129 129
 
130 130
  2. Using `shellfu import pretty`, we're importing module called "pretty".

+ 1
- 1
mkit.ini View File

@@ -43,7 +43,7 @@
43 43
 [files]
44 44
     bin      = src/bin/shellfu-doc
45 45
     bin      = src/bin/shellfu-embed
46
-    bin      = src/bin/shellfu-get
46
+    bin      = src/bin/sfpath
47 47
     doc      = LICENSE.md
48 48
     doc      = README.md
49 49
     etc_bc   = src/complete.bash       shellfu.bash

+ 1
- 1
packaging/debian/shellfu.install View File

@@ -1,5 +1,5 @@
1 1
 /etc/bash_completion.d/shellfu.bash
2
-/usr/bin/shellfu-get
2
+/usr/bin/sfpath
3 3
 /usr/share/doc/shellfu
4 4
 /usr/share/doc/shellfu/LICENSE.md
5 5
 /usr/share/doc/shellfu/README.md

+ 1
- 1
packaging/template.spec View File

@@ -88,7 +88,7 @@ make test \
88 88
 %dir %{_docdir}/%{name}
89 89
 %doc %{_docdir}/%{name}/LICENSE.md
90 90
 %doc %{_docdir}/%{name}/README.md
91
-%{_bindir}/shellfu-get
91
+%{_bindir}/sfpath
92 92
 %{_datadir}/%{name}/shellfu.sh
93 93
 
94 94
 %files bash

src/bin/shellfu-get.skel → src/bin/sfpath.skel View File

@@ -7,14 +7,14 @@ case $1 in
7 7
     --version-semver)
8 8
         echo "__MKIT_PROJ_VERSION__"
9 9
         ;;
10
-    path)
10
+    "")
11 11
         echo "${SHELLFU_DIR:-__SHELLFU_DIR__}/shellfu.sh"
12 12
         ;;
13 13
     *)
14
-        echo "usage: shellfu-get path" >&2
15
-        echo "usage: shellfu-get --version[-semver]" >&2
14
+        echo "usage: sfpath" >&2
15
+        echo "usage: sfpath --version[-semver]" >&2
16 16
         echo "" >&2
17
-        echo "Intended usage of shellfu-get is to determine path to library loader"
17
+        echo "Intended usage of sfpath is to determine path to library loader"
18 18
         echo "inside a shellfu script (first usage), or show Shellfu version." >&2
19 19
         echo "" >&2
20 20
         echo "Other usage is not recommended." >&2

+ 2
- 2
src/bin/shellfu-doc View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)" || exit 3
3
+. "$(sfpath)" || exit 3
4 4
 
5 5
 shellfu import pretty
6 6
 
@@ -51,7 +51,7 @@ export_as_manpage() {
51 51
             --center "User Contributed Shellfu Documentation" \
52 52
             --section 3x \
53 53
             --date "$(date -I -r "$mfile")" \
54
-            --release "shellfu v$(shellfu-get --version-semver)" \
54
+            --release "shellfu v$(sfpath --version-semver)" \
55 55
             --utf8 -q \`
56 56
 }
57 57
 

+ 6
- 14
src/complete.bash View File

@@ -1,23 +1,15 @@
1 1
 
2
-__shellfu_get() {
2
+__sfpath() {
3 3
     local cur prev opts
4 4
     COMPREPLY=()
5 5
     cur="${COMP_WORDS[COMP_CWORD]}"
6 6
     prev="${COMP_WORDS[COMP_CWORD-1]}"
7 7
     opts="--version --version-semver"
8
-    cmds="path"
8
+    COMPREPLY=(
9
+        $(compgen -W "$opts" -- ${cur})
10
+    )
11
+}
9 12
 
10
-    case "$cur" in
11
-        --*)
12
-            COMPREPLY=(
13
-                $(compgen -W "$opts" -- ${cur})
14
-            )
15
-            ;;
16
-        *)
17
-            COMPREPLY=(
18
-                $(compgen -W "$cmds" ${cur})
19
-            )
20
-    esac
21 13
 }
22 14
 
23
-complete -F __shellfu_get shellfu-get
15
+complete -F __sfpath sfpath

+ 3
- 3
tests/TF_HEADER View File

@@ -1,5 +1,5 @@
1 1
 #!/bin/sh
2 2
 
3
-echo "version = $(shellfu-get --version-semver)"
4
-echo "bin = $(which shellfu-get)"
5
-echo "init = $(shellfu-get path)"
3
+echo "version = $(sfpath --version-semver)"
4
+echo "bin = $(which sfpath)"
5
+echo "init = $(sfpath)"

+ 1
- 1
tests/inigrep_chars/TF_RUN View File

@@ -3,7 +3,7 @@
3 3
 . "$TF_DIR/include/subtest.sh"
4 4
 . "$TF_DIR/include/tools.sh"
5 5
 
6
-. "$(shellfu-get path)" || tf_exit_error "failed to init shellfu"
6
+. "$(sfpath)" || tf_exit_error "failed to init shellfu"
7 7
 export PRETTY=plain
8 8
 shellfu import inigrep  || tf_exit_error "failed to import inigrep"
9 9
 

+ 1
- 1
tests/inigrep_inigrep/TF_RUN View File

@@ -3,7 +3,7 @@
3 3
 . "$TF_DIR/include/subtest.sh"
4 4
 . "$TF_DIR/include/tools.sh"
5 5
 
6
-. "$(shellfu-get path)" || tf_exit_error "failed to init shellfu"
6
+. "$(sfpath)" || tf_exit_error "failed to init shellfu"
7 7
 shellfu import inigrep  || tf_exit_error "failed to import inigrep"
8 8
 
9 9
 tf_enum_subtests() {

+ 1
- 1
tests/mdfmt/TF_RUN View File

@@ -3,7 +3,7 @@
3 3
 . "$TF_DIR/include/subtest.sh"
4 4
 . "$TF_DIR/include/tools.sh"
5 5
 
6
-. "$(shellfu-get path)" || tf_exit_error "failed to init shellfu"
6
+. "$(sfpath)" || tf_exit_error "failed to init shellfu"
7 7
 export PRETTY=plain
8 8
 shellfu import mdfmt    || tf_exit_error "failed to import mdfmt"
9 9
 

+ 1
- 1
tests/pretty_basic/TF_RUN View File

@@ -3,7 +3,7 @@
3 3
 . "$TF_DIR/include/subtest.sh"
4 4
 . "$TF_DIR/include/tools.sh"
5 5
 
6
-. "$(shellfu-get path)" || tf_exit_error "failed to init shellfu"
6
+. "$(sfpath)" || tf_exit_error "failed to init shellfu"
7 7
 PRETTY=plain
8 8
 shellfu import pretty   || tf_exit_error "failed to import pretty"
9 9
 

+ 1
- 1
tests/pretty_basic/test/wrap_debug View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_die View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage-subcommand View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_0 View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_0w View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_1 View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_2 View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_all View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_allw View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_c View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_conflict View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_i View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_o View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_p View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 1
- 1
tests/pretty_basic/test/wrap_mkusage_self View File

@@ -1,6 +1,6 @@
1 1
 #!/bin/bash
2 2
 
3
-. "$(shellfu-get path)"
3
+. "$(sfpath)"
4 4
 
5 5
 shellfu import pretty
6 6
 

+ 4
- 4
tests/shellfu_import/TF_RUN View File

@@ -72,8 +72,8 @@ wrap_test() {
72 72
         mksnippet "$name.before"
73 73
         cat "test/$name.sh"
74 74
     fi \
75
-      | sed -e "s|\\<shellfu-get\\>|SHELLFU_DIR=${shellfu_init%/*}  $shellfu_get_path|"
76
-    #   ^^^ make `shellfu-get` work even if PATH is empty:
75
+      | sed -e "s|\\<sfpath\\>|SHELLFU_DIR=${shellfu_init%/*}  $sfpath|"
76
+    #   ^^^ make `sfpath` work even if PATH is empty:
77 77
     mksnippet "$name.after"
78 78
 }
79 79
 
@@ -101,8 +101,8 @@ tf_do_subtest() {
101 101
 }
102 102
 
103 103
 export LANG=C
104
-shellfu_get_path=$(which shellfu-get)
105
-shellfu_init=$(shellfu-get path)
104
+sfpath=$(which sfpath)  || tf_exit_error "cannot find sfpath"
105
+shellfu_init=$(sfpath)  || tf_exit_error "sfpath failed"
106 106
 ignored > _ignored_
107 107
 
108 108
 tf_do_subtests

+ 1
- 1
tests/shellfu_import/test/import_fn.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu import mod_f

+ 1
- 1
tests/shellfu_import/test/import_var.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu import mod_v

+ 1
- 1
tests/shellfu_import/test/import_var_fn.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu import mod_v_f

+ 1
- 1
tests/shellfu_import/test/import_var_fn_bash.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/bash
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu import mod_v_f_bash

+ 1
- 1
tests/shellfu_import/test/import_var_fn_bash_hint.sh View File

@@ -1,4 +1,4 @@
1 1
 SHELLFU_INCLUDE=test/include
2 2
 SHELLFU_COMPAT=bash
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu import mod_v_f_bash

+ 1
- 1
tests/shellfu_import/test/try_import_fn.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu try_import mod_f

+ 1
- 1
tests/shellfu_import/test/try_import_var.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu try_import mod_v

+ 1
- 1
tests/shellfu_import/test/try_import_var_fn.sh View File

@@ -1,4 +1,4 @@
1 1
 #!/bin/sh
2 2
 SHELLFU_INCLUDE=test/include
3
-. $(shellfu-get path)
3
+. $(sfpath)
4 4
 shellfu try_import mod_v_f

+ 1
- 1
tests/shellfu_version/TF_RUN View File

@@ -22,7 +22,7 @@ mkwrapper() {
22 22
     local modname=$1
23 23
     echo '#!/bin/bash'
24 24
     echo 'SHELLFU_PATH=test/shellfu'
25
-    echo '. "$(shellfu-get path)" || exit 3'
25
+    echo '. "$(sfpath)" || exit 3'
26 26
     echo "shellfu version $modname"
27 27
 }
28 28