dex-termux-cli 0.3.0-beta.3 → 0.3.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dex-project-context +12 -0
- package/package.json +4 -2
- package/src/commands/android-shell.js +76 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from '../src/app/main.js';
|
|
3
|
+
|
|
4
|
+
const argv = process.argv.slice(2);
|
|
5
|
+
|
|
6
|
+
if (argv.includes('--root')) {
|
|
7
|
+
await main(['--prompt-project-root']);
|
|
8
|
+
} else if (argv.includes('--path')) {
|
|
9
|
+
await main(['--prompt-project-path']);
|
|
10
|
+
} else {
|
|
11
|
+
await main(['--prompt-context']);
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dex-termux-cli",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Visual CLI for Termux and Linux with guided search, readable tree views, project context, version checks, Android mode, and safe flows for Python, Node, PHP, Ruby, Go, Rust, and Java.",
|
|
6
6
|
"keywords": [
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
],
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"bin": {
|
|
22
|
-
"dex": "bin/dex"
|
|
22
|
+
"dex": "bin/dex",
|
|
23
|
+
"dex-project-context": "bin/dex-project-context"
|
|
23
24
|
},
|
|
24
25
|
"scripts": {
|
|
25
26
|
"start": "node ./bin/dex",
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
"author": "farllirs",
|
|
30
31
|
"files": [
|
|
31
32
|
"bin/dex",
|
|
33
|
+
"bin/dex-project-context",
|
|
32
34
|
"src",
|
|
33
35
|
"data/commands/explain.json",
|
|
34
36
|
"README.md",
|
|
@@ -197,18 +197,50 @@ function buildLinuxShellRc({ aliases, root, label, shellName }) {
|
|
|
197
197
|
return [
|
|
198
198
|
...commonLines,
|
|
199
199
|
'[[ -f "$HOME/.zshrc" ]] && source "$HOME/.zshrc"',
|
|
200
|
+
'_dex_linux_project_root_zsh() {',
|
|
201
|
+
' local helper',
|
|
202
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
203
|
+
' [[ -z "$helper" ]] && return',
|
|
204
|
+
' "$helper" --root 2>/dev/null',
|
|
205
|
+
'}',
|
|
206
|
+
'_dex_linux_project_path_zsh() {',
|
|
207
|
+
' local helper',
|
|
208
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
209
|
+
' [[ -z "$helper" ]] && return',
|
|
210
|
+
' "$helper" --path 2>/dev/null',
|
|
211
|
+
'}',
|
|
200
212
|
'_dex_linux_project_badge_zsh() {',
|
|
201
|
-
' local
|
|
202
|
-
'
|
|
203
|
-
' [[ -z "$
|
|
204
|
-
' context="$($
|
|
213
|
+
' local helper context',
|
|
214
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
215
|
+
' [[ -z "$helper" ]] && return',
|
|
216
|
+
' context="$("$helper" 2>/dev/null)"',
|
|
205
217
|
' [[ -z "$context" ]] && return',
|
|
206
218
|
' print -n "%F{81}[$context]%f"',
|
|
207
219
|
'}',
|
|
220
|
+
'_dex_linux_path_label_zsh() {',
|
|
221
|
+
' local project_name project_path current relative',
|
|
222
|
+
' project_name="$(_dex_linux_project_root_zsh)"',
|
|
223
|
+
' project_path="$(_dex_linux_project_path_zsh)"',
|
|
224
|
+
' current="$PWD"',
|
|
225
|
+
' if [[ -n "$project_name" && -n "$project_path" ]]; then',
|
|
226
|
+
' project_name="${project_name##*/}"',
|
|
227
|
+
' if [[ "$current" == "$project_path" ]]; then',
|
|
228
|
+
' print -r -- "$project_name"',
|
|
229
|
+
' return',
|
|
230
|
+
' fi',
|
|
231
|
+
' relative="${current#$project_path/}"',
|
|
232
|
+
' if [[ "$relative" != "$current" ]]; then',
|
|
233
|
+
' print -r -- "$project_name/$relative"',
|
|
234
|
+
' return',
|
|
235
|
+
' fi',
|
|
236
|
+
' fi',
|
|
237
|
+
' print -r -- "%~"',
|
|
238
|
+
'}',
|
|
208
239
|
'_dex_linux_prompt_zsh() {',
|
|
209
|
-
' local badge',
|
|
240
|
+
' local badge path_label',
|
|
210
241
|
' badge="$(_dex_linux_project_badge_zsh)"',
|
|
211
|
-
"
|
|
242
|
+
' path_label="$(_dex_linux_path_label_zsh)"',
|
|
243
|
+
" PROMPT=$'%F{45}Dex@linux%f %F{117}'\"${path_label}\"$'%f\\n%F{45}>%f '",
|
|
212
244
|
' RPROMPT="$badge"',
|
|
213
245
|
'}',
|
|
214
246
|
'autoload -Uz add-zsh-hook 2>/dev/null || true',
|
|
@@ -221,18 +253,50 @@ function buildLinuxShellRc({ aliases, root, label, shellName }) {
|
|
|
221
253
|
if (shellName === 'bash') {
|
|
222
254
|
return [
|
|
223
255
|
...commonLines,
|
|
256
|
+
'_dex_linux_project_root_bash() {',
|
|
257
|
+
' local helper',
|
|
258
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
259
|
+
' [[ -z "$helper" ]] && return',
|
|
260
|
+
' "$helper" --root 2>/dev/null',
|
|
261
|
+
'}',
|
|
262
|
+
'_dex_linux_project_path_bash() {',
|
|
263
|
+
' local helper',
|
|
264
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
265
|
+
' [[ -z "$helper" ]] && return',
|
|
266
|
+
' "$helper" --path 2>/dev/null',
|
|
267
|
+
'}',
|
|
224
268
|
'_dex_linux_project_badge_bash() {',
|
|
225
|
-
' local
|
|
226
|
-
'
|
|
227
|
-
' [[ -z "$
|
|
228
|
-
' context="$($
|
|
269
|
+
' local helper context',
|
|
270
|
+
' helper="$(command -v dex-project-context 2>/dev/null)"',
|
|
271
|
+
' [[ -z "$helper" ]] && return',
|
|
272
|
+
' context="$("$helper" 2>/dev/null)"',
|
|
229
273
|
' [[ -z "$context" ]] && return',
|
|
230
274
|
' printf "\\[\\e[38;5;81m\\][%s]\\[\\e[0m\\]" "$context"',
|
|
231
275
|
'}',
|
|
276
|
+
'_dex_linux_path_label_bash() {',
|
|
277
|
+
' local project_name project_path current relative',
|
|
278
|
+
' project_name="$(_dex_linux_project_root_bash)"',
|
|
279
|
+
' project_path="$(_dex_linux_project_path_bash)"',
|
|
280
|
+
' current="$PWD"',
|
|
281
|
+
' if [[ -n "$project_name" && -n "$project_path" ]]; then',
|
|
282
|
+
' project_name="${project_name##*/}"',
|
|
283
|
+
' if [[ "$current" == "$project_path" ]]; then',
|
|
284
|
+
' printf "%s" "$project_name"',
|
|
285
|
+
' return',
|
|
286
|
+
' fi',
|
|
287
|
+
' relative="${current#$project_path/}"',
|
|
288
|
+
' if [[ "$relative" != "$current" ]]; then',
|
|
289
|
+
' printf "%s/%s" "$project_name" "$relative"',
|
|
290
|
+
' return',
|
|
291
|
+
' fi',
|
|
292
|
+
' fi',
|
|
293
|
+
' printf "%s" "\\w"',
|
|
294
|
+
'}',
|
|
232
295
|
'_dex_linux_prompt_bash() {',
|
|
233
|
-
' local badge',
|
|
296
|
+
' local badge path_label',
|
|
234
297
|
' badge="$(_dex_linux_project_badge_bash)"',
|
|
235
|
-
'
|
|
298
|
+
' path_label="$(_dex_linux_path_label_bash)"',
|
|
299
|
+
' PS1="\\[\\e[38;5;45m\\]Dex@linux\\[\\e[0m\\] \\[\\e[38;5;117m\\]${path_label}\\[\\e[0m\\] ${badge}\\n\\[\\e[38;5;45m\\]>\\[\\e[0m\\] "',
|
|
236
300
|
'}',
|
|
237
301
|
'PROMPT_COMMAND=_dex_linux_prompt_bash',
|
|
238
302
|
'_dex_linux_prompt_bash',
|