-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathutility.sh
More file actions
71 lines (59 loc) · 1.62 KB
/
Copy pathutility.sh
File metadata and controls
71 lines (59 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
_U7_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck disable=SC1090
for _u7_mod in core show make drop convert move set run completions; do
source "$_U7_DIR/lib/${_u7_mod}.sh" || { echo "u7: failed to load lib/${_u7_mod}.sh" >&2; unset _u7_mod _U7_DIR; return 1; }
done
unset _u7_mod _U7_DIR
u7() {
_U7_DRY_RUN=0
if [[ "$1" == "--dry-run" || "$1" == "-n" ]]; then
_U7_DRY_RUN=1
shift
fi
local verb="$1"
shift
case "$verb" in
show|sh) _u7_show "$@" ;;
make|mk) _u7_make "$@" ;;
drop|dr) _u7_drop "$@" ;;
convert|cv) _u7_convert "$@" ;;
move|mv) _u7_move "$@" ;;
set|st) _u7_set "$@" ;;
run|rn) _u7_run "$@" ;;
--help|-h|"") _u7_help ;;
*)
echo "Unknown verb: $verb"
_u7_help
return 1
;;
esac
}
_u7_help() {
cat << 'EOF'
Universal 7 (u7) - Human+AI CLI Standard
Usage: u7 [-n|--dry-run] <verb> <entity> [operator] [arguments]
Options:
-n, --dry-run Show command without executing
Verbs:
sh (show) Observe/Search
mk (make) Create/Clone
dr (drop) Delete/Kill
cv (convert) Transform/Extract
mv (move) Relocate/Rename
st (set) Modify/Config
rn (run) Execute/Control
Examples:
u7 sh ip external
u7 sh csv data.csv limit 10
u7 mk dir myproject
u7 mk password length 16
u7 dr file temp.txt
u7 cv archive backup.tar.gz to files yield ./
u7 cv image photo.png to jpg yield photo.jpg
u7 mv file old.txt to new.txt
u7 st text "old" to "new" in file.txt
u7 rn job "echo done" in 5s
Run 'u7 <verb> --help' for verb-specific help.
EOF
}