buninu 0.2.5 → 0.3.1

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.
Files changed (122) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +100 -2
  3. package/apps/bunmsh/CHANGELOG.md +262 -0
  4. package/apps/bunmsh/LICENSE +21 -0
  5. package/apps/bunmsh/LICENSE-MKSH +295 -0
  6. package/apps/bunmsh/PORTING.md +192 -0
  7. package/apps/bunmsh/README.md +801 -0
  8. package/apps/bunmsh/bunmsh +7 -0
  9. package/apps/bunmsh/bunshell.md +61 -0
  10. package/apps/bunmsh/help/README.md +1945 -0
  11. package/apps/bunmsh/help/alias.md +22 -0
  12. package/apps/bunmsh/help/basename.md +38 -0
  13. package/apps/bunmsh/help/builtin.md +25 -0
  14. package/apps/bunmsh/help/bun.md +27 -0
  15. package/apps/bunmsh/help/bunmsh.md +47 -0
  16. package/apps/bunmsh/help/cat.md +31 -0
  17. package/apps/bunmsh/help/catfancy.md +35 -0
  18. package/apps/bunmsh/help/cd.md +22 -0
  19. package/apps/bunmsh/help/chmod.md +27 -0
  20. package/apps/bunmsh/help/clear.md +21 -0
  21. package/apps/bunmsh/help/colon.md +22 -0
  22. package/apps/bunmsh/help/command.md +27 -0
  23. package/apps/bunmsh/help/cp.md +28 -0
  24. package/apps/bunmsh/help/cut.md +25 -0
  25. package/apps/bunmsh/help/date.md +25 -0
  26. package/apps/bunmsh/help/dirname.md +25 -0
  27. package/apps/bunmsh/help/echo.md +25 -0
  28. package/apps/bunmsh/help/env.md +27 -0
  29. package/apps/bunmsh/help/eval.md +22 -0
  30. package/apps/bunmsh/help/exec.md +22 -0
  31. package/apps/bunmsh/help/exit.md +21 -0
  32. package/apps/bunmsh/help/export.md +22 -0
  33. package/apps/bunmsh/help/false.md +22 -0
  34. package/apps/bunmsh/help/find.md +33 -0
  35. package/apps/bunmsh/help/getopts.md +28 -0
  36. package/apps/bunmsh/help/grep.md +34 -0
  37. package/apps/bunmsh/help/head.md +27 -0
  38. package/apps/bunmsh/help/kill.md +27 -0
  39. package/apps/bunmsh/help/ln.md +28 -0
  40. package/apps/bunmsh/help/ls.md +37 -0
  41. package/apps/bunmsh/help/lsbun.md +29 -0
  42. package/apps/bunmsh/help/lsfancy.md +37 -0
  43. package/apps/bunmsh/help/md5sum.md +21 -0
  44. package/apps/bunmsh/help/mkdir.md +27 -0
  45. package/apps/bunmsh/help/mktemp.md +26 -0
  46. package/apps/bunmsh/help/mv.md +26 -0
  47. package/apps/bunmsh/help/print.md +30 -0
  48. package/apps/bunmsh/help/printf.md +25 -0
  49. package/apps/bunmsh/help/pwd.md +21 -0
  50. package/apps/bunmsh/help/read.md +27 -0
  51. package/apps/bunmsh/help/readonly.md +27 -0
  52. package/apps/bunmsh/help/realpath.md +21 -0
  53. package/apps/bunmsh/help/rm.md +33 -0
  54. package/apps/bunmsh/help/rmdir.md +27 -0
  55. package/apps/bunmsh/help/sed.md +29 -0
  56. package/apps/bunmsh/help/seq.md +29 -0
  57. package/apps/bunmsh/help/serve.md +50 -0
  58. package/apps/bunmsh/help/set.md +26 -0
  59. package/apps/bunmsh/help/sha256sum.md +21 -0
  60. package/apps/bunmsh/help/shift.md +23 -0
  61. package/apps/bunmsh/help/sleep.md +25 -0
  62. package/apps/bunmsh/help/sort.md +29 -0
  63. package/apps/bunmsh/help/source.md +23 -0
  64. package/apps/bunmsh/help/tab.md +30 -0
  65. package/apps/bunmsh/help/tac.md +29 -0
  66. package/apps/bunmsh/help/tail.md +27 -0
  67. package/apps/bunmsh/help/tee.md +25 -0
  68. package/apps/bunmsh/help/test.md +30 -0
  69. package/apps/bunmsh/help/time.md +29 -0
  70. package/apps/bunmsh/help/touch.md +26 -0
  71. package/apps/bunmsh/help/tr.md +26 -0
  72. package/apps/bunmsh/help/true.md +22 -0
  73. package/apps/bunmsh/help/type.md +21 -0
  74. package/apps/bunmsh/help/umask.md +22 -0
  75. package/apps/bunmsh/help/unalias.md +28 -0
  76. package/apps/bunmsh/help/uname.md +31 -0
  77. package/apps/bunmsh/help/unset.md +28 -0
  78. package/apps/bunmsh/help/wc.md +27 -0
  79. package/apps/bunmsh/help/whence.md +26 -0
  80. package/apps/bunmsh/help/which.md +41 -0
  81. package/apps/bunmsh/help/yes.md +23 -0
  82. package/apps/bunmsh/package.json +26 -0
  83. package/apps/bunmsh/serve.js +468 -0
  84. package/apps/bunmsh/single-exe/README.md +402 -0
  85. package/apps/bunmsh/single-exe/assetsHelper.js +371 -0
  86. package/apps/bunmsh/single-exe/assetsLoader.mjs +85 -0
  87. package/apps/bunmsh/single-exe/assetsPacker.js +218 -0
  88. package/apps/bunmsh/single-exe/compiled.js +527 -0
  89. package/apps/bunmsh/single-exe/entry.mjs +17 -0
  90. package/apps/bunmsh/src/cat-fancy.js +117 -0
  91. package/apps/bunmsh/src/cat-operands.js +31 -0
  92. package/apps/bunmsh/src/completion.js +247 -0
  93. package/apps/bunmsh/src/environment.js +61 -0
  94. package/apps/bunmsh/src/fancy-ls.js +186 -0
  95. package/apps/bunmsh/src/find.js +119 -0
  96. package/apps/bunmsh/src/history.js +198 -0
  97. package/apps/bunmsh/src/main.js +776 -0
  98. package/apps/bunmsh/src/mouse.js +103 -0
  99. package/apps/bunmsh/src/shell.js +3557 -0
  100. package/apps/bunmsh/test/catfancy.test.js +102 -0
  101. package/apps/bunmsh/test/reference-source.sh +1 -0
  102. package/apps/bunmsh/test/reference.test.js +677 -0
  103. package/apps/bunmsh/test/serve/README.md +3 -0
  104. package/apps/bunmsh/test/serve/bad.json +1 -0
  105. package/apps/bunmsh/test/serve/data.json +1 -0
  106. package/apps/bunmsh/test/serve/data.json5 +1 -0
  107. package/apps/bunmsh/test/serve/data.jsonc +2 -0
  108. package/apps/bunmsh/test/serve/data.jsonl +2 -0
  109. package/apps/bunmsh/test/serve/data.ndjson +1 -0
  110. package/apps/bunmsh/test/serve/data.toml +3 -0
  111. package/apps/bunmsh/test/serve/data.ts +15 -0
  112. package/apps/bunmsh/test/serve/data.xml +1 -0
  113. package/apps/bunmsh/test/serve/data.yaml +3 -0
  114. package/apps/bunmsh/test/serve/data.yml +1 -0
  115. package/apps/bunmsh/test/serve.test.js +241 -0
  116. package/apps/bunmsh/test/shell.test.js +1778 -0
  117. package/apps/bunmsh/test/t.sh +12 -0
  118. package/apps/native-bridge/native-bridge.js +45 -0
  119. package/apps/xdg-open/xdg-open.js +74 -2
  120. package/bin/init.js +11 -3
  121. package/demo-server.js +64 -0
  122. package/package.json +4 -2
@@ -0,0 +1,21 @@
1
+ ## sha256sum
2
+
3
+ Print SHA-256 hashes.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ sha256sum [FILE ...]
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ printf hello | sha256sum
15
+ ```
16
+
17
+ Output:
18
+
19
+ ```text
20
+ 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 -
21
+ ```
@@ -0,0 +1,23 @@
1
+ ## shift
2
+
3
+ Discard leading positional parameters.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ shift [COUNT]
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ set -- one two three
15
+ shift
16
+ echo "$1 $2"
17
+ ```
18
+
19
+ Output:
20
+
21
+ ```text
22
+ two three
23
+ ```
@@ -0,0 +1,25 @@
1
+ ## sleep
2
+
3
+ Pause; supports ms, s, m, and h suffixes.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ sleep DURATION
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - Bare durations are seconds; suffixes `ms`, `s`, `m`, and `h` select milliseconds, seconds, minutes, and hours.
14
+
15
+ ### Example
16
+
17
+ ```sh
18
+ time sleep 10ms
19
+ ```
20
+
21
+ Output:
22
+
23
+ ```text
24
+ real 10.000000 ms
25
+ ```
@@ -0,0 +1,29 @@
1
+ ## sort
2
+
3
+ Sort, reverse, compare numerically, or deduplicate lines.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ sort [-rnu] [FILE ...]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-r`: Reverse the result.
14
+ - `-n`: Compare numerically.
15
+ - `-u`: Remove duplicate lines. These short flags may be combined.
16
+
17
+ ### Example
18
+
19
+ ```sh
20
+ printf 'c\na\nb\n' | sort
21
+ ```
22
+
23
+ Output:
24
+
25
+ ```text
26
+ a
27
+ b
28
+ c
29
+ ```
@@ -0,0 +1,23 @@
1
+ ## source
2
+
3
+ Evaluate a file in the current shell.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ source FILE [ARG ...]
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ printf 'NAME=sourced\n' > settings.sh
15
+ source settings.sh
16
+ echo "$NAME"
17
+ ```
18
+
19
+ Output:
20
+
21
+ ```text
22
+ sourced
23
+ ```
@@ -0,0 +1,30 @@
1
+ ## tab
2
+
3
+ Manage directory tabs and shell session controls.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ tab [n | x | c | l | r | s | save | path | mouse | NUMBER]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `n` creates a tab; `x`/`c` closes it; `l` and `r` switch tabs.
14
+ - `save`/`s` saves history; `save d` deduplicates it.
15
+ - `path [on|off|true|false]` controls PATH lookup.
16
+ - `mouse [on|off|true|false]` controls terminal mouse tracking.
17
+ - A numeric operand selects that tab.
18
+
19
+ ### Example
20
+
21
+ ```sh
22
+ tab
23
+ ```
24
+
25
+ Output:
26
+
27
+ ```text
28
+ 📁 ~/project 📂 ~/project
29
+ [2]$
30
+ ```
@@ -0,0 +1,29 @@
1
+ ## tac
2
+
3
+ Reverse newline-delimited records in each input file.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ tac [--] [FILE ...]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `--`: Stop option parsing.
14
+ - `-`: Read from stdin at that operand position.
15
+ - Other options are not currently supported.
16
+
17
+ ### Example
18
+
19
+ ```sh
20
+ printf 'one\ntwo\nthree\n' | tac
21
+ ```
22
+
23
+ Output:
24
+
25
+ ```text
26
+ three
27
+ two
28
+ one
29
+ ```
@@ -0,0 +1,27 @@
1
+ ## tail
2
+
3
+ Write the last lines, or start output at a selected line.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ tail [-n N | -N | -n +N | -n+N] [FILE ...]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-n N`, `-N`: Write the last N lines.
14
+ - `-n +N`, `-n+N`: Start output at line N.
15
+
16
+ ### Example
17
+
18
+ ```sh
19
+ printf 'one\ntwo\nthree\n' | tail -n 2
20
+ ```
21
+
22
+ Output:
23
+
24
+ ```text
25
+ two
26
+ three
27
+ ```
@@ -0,0 +1,25 @@
1
+ ## tee
2
+
3
+ Copy stdin to stdout and files.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ tee [-a] [FILE ...]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-a`: Append to files rather than replacing them.
14
+
15
+ ### Example
16
+
17
+ ```sh
18
+ printf hello | tee output.txt
19
+ ```
20
+
21
+ Output:
22
+
23
+ ```text
24
+ hello
25
+ ```
@@ -0,0 +1,30 @@
1
+ ## test
2
+
3
+ Evaluate file, string, and integer expressions; [ requires a closing ].
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ test EXPRESSION
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - Unary file tests: `-e`, `-f`, `-d`, `-b`, `-c`, `-p`, `-S`, `-L`/`-h`, `-s`, `-r`, `-w`, and `-x`.
14
+ - Unary string tests: `-n` and `-z`.
15
+ - String comparisons: `=`, `==`, and `!=`.
16
+ - Integer comparisons: `-eq`, `-ne`, `-gt`, `-ge`, `-lt`, and `-le`.
17
+ - File comparisons: `-nt`, `-ot`, and `-ef`. Logical `!`, `-a`, and `-o` are supported.
18
+
19
+ ### Example
20
+
21
+ ```sh
22
+ test -d /tmp
23
+ echo $?
24
+ ```
25
+
26
+ Output:
27
+
28
+ ```text
29
+ 0
30
+ ```
@@ -0,0 +1,29 @@
1
+ ## time
2
+
3
+ Run a command and report elapsed time.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ time [COMMAND [ARG ...]]
9
+ ```
10
+
11
+ ### Display
12
+
13
+ - Elapsed time is written to stderr in milliseconds with six decimal places.
14
+ - When stderr is a terminal, each three-digit magnitude group uses a different
15
+ ANSI color, making units and fractional precision easier to distinguish.
16
+ - The decimal point is dimmed. Colors are omitted when stderr is redirected or
17
+ captured.
18
+
19
+ ### Example
20
+
21
+ ```sh
22
+ time true
23
+ ```
24
+
25
+ Output:
26
+
27
+ ```text
28
+ real 0.000000 ms
29
+ ```
@@ -0,0 +1,26 @@
1
+ ## touch
2
+
3
+ Create files or update timestamps.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ touch FILE ...
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - No options are currently supported.
14
+
15
+ ### Example
16
+
17
+ ```sh
18
+ touch created.txt
19
+ builtin test -f created.txt; echo $?
20
+ ```
21
+
22
+ Output:
23
+
24
+ ```text
25
+ 0
26
+ ```
@@ -0,0 +1,26 @@
1
+ ## tr
2
+
3
+ Translate or delete characters.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ tr [-d] SET1 [SET2]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-d`: Delete characters in SET1 instead of translating them.
14
+ - Simple ranges such as `a-z` are supported.
15
+
16
+ ### Example
17
+
18
+ ```sh
19
+ printf 'hello\n' | tr a-z A-Z
20
+ ```
21
+
22
+ Output:
23
+
24
+ ```text
25
+ HELLO
26
+ ```
@@ -0,0 +1,22 @@
1
+ ## true
2
+
3
+ Return success.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ true
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ true
15
+ echo $?
16
+ ```
17
+
18
+ Output:
19
+
20
+ ```text
21
+ 0
22
+ ```
@@ -0,0 +1,21 @@
1
+ ## type
2
+
3
+ Describe how command names resolve.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ type NAME ...
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ type echo
15
+ ```
16
+
17
+ Output:
18
+
19
+ ```text
20
+ echo is a shell builtin
21
+ ```
@@ -0,0 +1,22 @@
1
+ ## umask
2
+
3
+ Print or set the file-creation mask.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ umask [MODE]
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ umask 022
15
+ umask
16
+ ```
17
+
18
+ Output:
19
+
20
+ ```text
21
+ 0022
22
+ ```
@@ -0,0 +1,28 @@
1
+ ## unalias
2
+
3
+ Remove aliases.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ unalias [-a] [--] NAME ...
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-a`: Remove every alias.
14
+ - `--`: Stop option parsing.
15
+
16
+ ### Example
17
+
18
+ ```sh
19
+ alias ll='ls -l'
20
+ unalias ll
21
+ type ll
22
+ ```
23
+
24
+ Output:
25
+
26
+ ```text
27
+ ll not found
28
+ ```
@@ -0,0 +1,31 @@
1
+ ## uname
2
+
3
+ Print system information.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ uname [-asnrvmp]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-a`: Select all supported fields.
14
+ - `-s`: System name.
15
+ - `-n`: Host name.
16
+ - `-r`: OS release.
17
+ - `-v`: OS version.
18
+ - `-m`: Machine architecture.
19
+ - `-p`: Processor architecture. Short flags may be combined.
20
+
21
+ ### Example
22
+
23
+ ```sh
24
+ uname -mprs
25
+ ```
26
+
27
+ Output:
28
+
29
+ ```text
30
+ Linux 6.17.0-PRoot-Distro aarch64 aarch64
31
+ ```
@@ -0,0 +1,28 @@
1
+ ## unset
2
+
3
+ Remove shell variables.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ unset [-v] [--] NAME ...
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-v`: Explicitly select variables (the only supported unset kind).
14
+ - `--`: Stop option parsing.
15
+
16
+ ### Example
17
+
18
+ ```sh
19
+ NAME=value
20
+ unset NAME
21
+ echo "${NAME:-missing}"
22
+ ```
23
+
24
+ Output:
25
+
26
+ ```text
27
+ missing
28
+ ```
@@ -0,0 +1,27 @@
1
+ ## wc
2
+
3
+ Count lines, words, and bytes.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ wc [-lwc] [FILE ...]
9
+ ```
10
+
11
+ ### Options and forms
12
+
13
+ - `-l`: Count lines.
14
+ - `-w`: Count words.
15
+ - `-c`: Count bytes. Short flags may be combined.
16
+
17
+ ### Example
18
+
19
+ ```sh
20
+ printf 'one two\n' | wc -lwc
21
+ ```
22
+
23
+ Output:
24
+
25
+ ```text
26
+ 1 2 8
27
+ ```
@@ -0,0 +1,26 @@
1
+ ## whence
2
+
3
+ Describe command lookup.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ whence [-pv] NAME ...
9
+ ```
10
+
11
+ ### Options
12
+
13
+ - `-p`: Search `PATH` only, ignoring aliases, functions, and builtins.
14
+ - `-v`: Print a verbose description of how each name resolves.
15
+
16
+ ### Example
17
+
18
+ ```sh
19
+ whence -p bun
20
+ ```
21
+
22
+ Output:
23
+
24
+ ```text
25
+ /data/data/com.termux/files/usr/bin/bun
26
+ ```
@@ -0,0 +1,41 @@
1
+ ## which
2
+
3
+ Print executable paths found through PATH.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ which NAME ...
9
+ ```
10
+
11
+ ### Behavior
12
+
13
+ - `which` explicitly searches the current `PATH`, even when normal PATH command
14
+ lookup is disabled by `bunmsh --builtin-only` or `tab path off`.
15
+ - Use command substitution such as `"$(which NAME)"` to obtain an explicit path
16
+ and run an external command in either mode.
17
+
18
+ ### Example
19
+
20
+ ```sh
21
+ which bun
22
+ ```
23
+
24
+ Output:
25
+
26
+ ```text
27
+ /data/data/com.termux/files/usr/bin/bun
28
+ ```
29
+
30
+ To explicitly run a PATH command while normal PATH lookup is disabled:
31
+
32
+ ```sh
33
+ tab path off
34
+ "$(which sh)" -c 'printf path-command'
35
+ ```
36
+
37
+ Output:
38
+
39
+ ```text
40
+ path-command
41
+ ```
@@ -0,0 +1,23 @@
1
+ ## yes
2
+
3
+ Repeatedly write the strings, or y by default.
4
+
5
+ ### Usage
6
+
7
+ ```sh
8
+ yes [STRING ...]
9
+ ```
10
+
11
+ ### Example
12
+
13
+ ```sh
14
+ yes ok | head -n 3
15
+ ```
16
+
17
+ Output:
18
+
19
+ ```text
20
+ ok
21
+ ok
22
+ ok
23
+ ```
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "bunmsh",
3
+ "version": "0.2.0",
4
+ "description": "Cross-platform command shell for Bun JavaScript",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./src/main.js",
8
+ "bin": {
9
+ "bunmsh": "./src/main.js"
10
+ },
11
+ "scripts": {
12
+ "start": "bun ./src/main.js",
13
+ "test": "bun test"
14
+ },
15
+ "keywords": [
16
+ "bun",
17
+ "shell",
18
+ "command-line",
19
+ "mksh"
20
+ ],
21
+ "assets": [
22
+ "README.md",
23
+ "CHANGELOG.md",
24
+ "help"
25
+ ]
26
+ }