OILS / _gen / bin / text_files.cc View on Github | oilshell.org

1639 lines, 143 significant
1
2#include "cpp/embedded_file.h"
3
4namespace embedded_file {
5GLOBAL_STR(gStr0, R"zZXx(
6 Errors
7 <a class="group-link" href="chap-errors.html">errors</a>
8
9
10 [UTF8] err-utf8-encode err-utf8-decode
11 [J8 String] err-j8-str-encode err-j8-str-decode
12 [J8 Lines] err-j8-lines-encode err-j8-lines-decode
13 [JSON] err-json-encode err-json-decode
14 [JSON8] err-json8-encode err-json8-decode
15)zZXx");
16
17GLOBAL_STR(gStr1, R"zZXx(
18
19 Front End <a class="group-link" href="chap-front-end.html">front-end</a>
20
21
22 [Lexing] ascii-whitespace [ \t\r\n]
23 ascii-control-chars
24)zZXx");
25
26GLOBAL_STR(gStr2, R"zZXx(
27 J8 Notation
28 <a class="group-link" href="chap-j8.html">j8</a>
29
30
31 [J8 Strings] json-string "hi"
32 json-escape \" \\ \u1234
33 surrogate-pair \ud83e\udd26
34 j8-escape \' \u{1f926} \yff
35 u-prefix u'hi'
36 b-prefix b'hi'
37 no-prefix 'hi'
38 [J8 Lines] unquoted-line
39 [JSON8] json8-num json8-str
40 X json8-list X json8-dict
41 json8-comment
42 [TSV8] column-attrs column-types
43)zZXx");
44
45GLOBAL_STR(gStr3, R"zZXx(Usage: help TOPIC?
46
47Examples:
48
49 help # this help
50 help echo # help on the 'echo' builtin
51 help command-sub # help on command sub $(date)
52
53 help oils-usage # identical to oils-for-unix --help
54 help osh-usage # osh --help
55 help ysh-usage # ysh --help
56)zZXx");
57
58GLOBAL_STR(gStr4, R"zZXx(bin/oils-for-unix is an executable that contains OSH, YSH, and more.
59
60Usage: oils-for-unix MAIN_NAME ARG*
61 MAIN_NAME ARG*
62
63It behaves like busybox. The command name can be passed as the first argument:
64
65 oils-for-unix ysh -c 'echo hi'
66
67More commonly, it's invoked through a symlink like 'ysh', which causes it to
68behave like that command:
69
70 ysh -c 'echo hi'
71)zZXx");
72
73GLOBAL_STR(gStr5, R"zZXx(
74 Builtin Commands <a class="group-link" href="chap-builtin-cmd.html">builtin-cmd</a>
75
76
77 [I/O] read echo printf
78 readarray mapfile
79 [Run Code] source . eval trap
80 [Set Options] set shopt
81 [Working Dir] cd pwd pushd popd dirs
82 [Completion] complete compgen compopt compadjust compexport
83 [Shell Process] exec X logout
84 umask ulimit times
85 [Child Process] jobs wait
86 fg X bg X kill X disown
87 [External] test [ getopts
88 [Introspection] help hash cmd/type X caller
89 [Word Lookup] command builtin
90 [Interactive] alias unalias history X fc X bind
91X [Unsupported] enable
92)zZXx");
93
94GLOBAL_STR(gStr6, R"zZXx(The reference is divided in to "chapters", each of which has its own table of
95contents. Type:
96
97 help osh-$CHAPTER
98
99Where $CHAPTER is one of:
100
101 front-end
102 command-lang
103 osh-assign
104 word-lang
105 mini-lang
106 builtin-cmd
107 option
108 special-var
109 plugin
110
111Example:
112
113 help osh-word-lang
114)zZXx");
115
116GLOBAL_STR(gStr7, R"zZXx(
117 Command Language <a class="group-link" href="chap-cmd-lang.html">cmd-lang</a>
118
119
120 [Commands] simple-command semicolon ;
121 [Conditional] case if dbracket [[
122 true false colon :
123 bang ! and && or ||
124 [Iteration] while until for for-expr-sh ((
125 [Control Flow] break continue return exit
126 [Grouping] sh-func sh-block { subshell (
127 [Concurrency] pipe | X pipe-amp |& ampersand &
128 [Redirects] redir-file > >> >| < <> not impl: &>
129 redir-desc >& <&
130 here-doc << <<- <<<
131 [Other Command] dparen (( time X coproc X select
132)zZXx");
133
134GLOBAL_STR(gStr8, R"zZXx(
135 Front End <a class="group-link" href="chap-front-end.html">front-end</a>
136
137
138 [Usage] oils-usage osh-usage config
139 startup line-editing exit-codes
140 [Lexing] comment # line-continuation \ ascii-whitespace [ \t\r\n]
141)zZXx");
142
143GLOBAL_STR(gStr9, R"zZXx(
144 Other Mini Languages <a class="group-link" href="chap-mini-lang.html">mini-lang</a>
145
146
147 [Arithmetic] arith-context Where legacy arithmetic is allowed
148 sh-numbers 0xFF 0755 etc.
149 sh-arith 1 + 2*3 a *= 2
150 sh-logical !a && b
151 sh-bitwise ~a ^ b
152 [Boolean] bool-expr [[ ! $x && $y || $z ]]
153 test ! $x -a $y -o $z
154 bool-infix $a -nt $b $x == $y
155 bool-path -d /etc
156 bool-str -n foo -z ''
157 bool-other -o errexit -v name[index]
158 [Patterns] glob-pat *.py
159 extglob ,(*.py|*.sh)
160 regex [[ foo =~ [a-z]+ ]]
161 [Other Sublang] braces {alice,bob}@example.com
162 histsub !$ !! !n
163 char-escapes \t \c \x00 \u03bc
164)zZXx");
165
166GLOBAL_STR(gStr10, R"zZXx(
167 Global Shell Options <a class="group-link" href="chap-option.html">option</a>
168
169
170 [Errors] nounset -u errexit -e inherit_errexit pipefail
171 [Globbing] noglob -f nullglob failglob X dotglob
172 dashglob (true)
173 [Debugging] xtrace X verbose X extdebug
174 [Interactive] emacs vi
175 [Other POSIX] X noclobber
176 [Compat] eval_unsafe_arith ignore_flags_not_impl
177)zZXx");
178
179GLOBAL_STR(gStr11, R"zZXx(
180 Assignments and Expressions <a class="group-link" href="chap-osh-assign.html">osh-assign</a>
181
182
183 [Literals] sh-array array=(a b c) array[1]=B "${a[@]}"
184 sh-assoc assoc=(['a']=1 ['b']=2) assoc['x']=b
185 [Operators] sh-assign str='xyz'
186 sh-append str+='abc'
187 [Builtins] local readonly export unset shift
188 declare typeset X let
189)zZXx");
190
191GLOBAL_STR(gStr12, R"zZXx(
192 Plugins and Hooks <a class="group-link" href="chap-plugin.html">plugin</a>
193
194
195 [Signals] SIGTERM SIGINT SIGQUIT
196 SIGTTIN SIGTTOU SIGWINCH
197 [Traps] DEBUG ERR EXIT X RETURN
198 [Words] PS1 X PS2 X PS3 PS4
199 [Completion] complete
200 [Other Plugin] PROMPT_COMMAND X command_not_found
201)zZXx");
202
203GLOBAL_STR(gStr13, R"zZXx(
204 Special Variables <a class="group-link" href="chap-special-var.html">special-var</a>
205
206
207 [POSIX Special] $@ $* $# $? $- $$ $! $0 $9
208 [Shell Vars] IFS X LANG X GLOBIGNORE
209 [Shell Options] SHELLOPTS X BASHOPTS
210 [Other Env] HOME PATH
211 [Other Special] BASH_REMATCH @PIPESTATUS
212 [Platform] HOSTNAME OSTYPE
213 [Call Stack] @BASH_SOURCE @FUNCNAME @BASH_LINENO
214 X @BASH_ARGV X @BASH_ARGC
215 [Tracing] LINENO
216 [Process State] UID EUID PPID X BASHPID
217X [Process Stack] BASH_SUBSHELL SHLVL
218X [Shell State] BASH_CMDS @DIRSTACK
219 [Completion] @COMP_WORDS COMP_CWORD COMP_LINE COMP_POINT
220 COMP_WORDBREAKS @COMPREPLY X COMP_KEY
221 X COMP_TYPE COMP_ARGV
222 [History] HISTFILE
223 [cd] PWD OLDPWD X CDPATH
224 [getopts] OPTIND OPTARG X OPTERR
225 [read] REPLY
226 [Functions] X RANDOM SECONDS
227)zZXx");
228
229GLOBAL_STR(gStr14, R"zZXx(
230 Standard Library <a class="group-link" href="chap-stdlib.html">stdlib</a>
231
232
233 [bash-strict]
234 [two] log die
235 [no-quotes] nq-capture nq-capture-2 nq-assert
236 [byo-server] byo-maybe-run byo-must-run
237 [task-five]
238)zZXx");
239
240GLOBAL_STR(gStr15, R"zZXx(
241 OSH Types <a class="group-link" href="chap-type-method.html">type-method</a>
242
243
244 [OSH] BashArray BashAssoc
245)zZXx");
246
247GLOBAL_STR(gStr16, R"zZXx(bin/osh is compatible with POSIX shell, bash, and other shells.
248
249Usage: osh FLAG* SCRIPT ARG*
250 osh FLAG* -c COMMAND ARG*
251 osh FLAG*
252
253The command line accepted by `bin/osh` is compatible with /bin/sh and bash.
254
255 osh -c 'echo hi'
256 osh myscript.sh
257 echo 'echo hi' | osh
258
259It also has a few enhancements:
260
261 osh -n -c 'hello' # pretty-print the AST
262 osh --ast-format text -n -c 'hello' # print it full
263
264osh accepts POSIX sh flags, with these additions:
265
266 -n parse the program but don't execute it. Print the AST.
267 --ast-format what format the AST should be in
268)zZXx");
269
270GLOBAL_STR(gStr17, R"zZXx(
271 Word Language <a class="group-link" href="chap-word-lang.html">word-lang</a>
272
273
274 [Quotes] osh-string 'abc' $'line\n' "$var"
275 [Substitutions] command-sub $(command) `command`
276 var-sub ${var} $0 $9
277 arith-sub $((1 + 2))
278 tilde-sub ~/src
279 proc-sub diff <(sort L.txt) <(sort R.txt)
280 [Var Ops] op-test ${x:-default}
281 op-strip ${x%%suffix} etc.
282 op-replace ${x//y/z}
283 op-index ${a[i+1}
284 op-slice ${a[@]:0:1}
285 op-format ${x@P}
286)zZXx");
287
288GLOBAL_STR(gStr18, R"zZXx(
289 Builtin Commands <a class="group-link" href="chap-builtin-cmd.html">builtin-cmd</a>
290
291
292 [Memory] cmd/append Add elements to end of array
293 pp asdl cell X gc-stats line proc
294 [Handle Errors] error error 'failed' (status=2)
295 try Run with errexit, set _error
296 failed Test if _error.code !== 0
297 boolstatus Enforce 0 or 1 exit status
298 [Shell State] ysh-cd ysh-shopt compatible, and takes a block
299 shvar Temporary modify global settings
300 ctx Share and update a temporary "context"
301 push-registers Save registers like $?, PIPESTATUS
302 [Modules] runproc Run a proc; use as main entry point
303 module guard against duplicate 'source'
304 is-main false when sourcing a file
305 use change first word lookup
306 [I/O] ysh-read flags --all, -0
307 ysh-echo no -e -n with simple_echo
308 write Like echo, with --, --sep, --end
309 fork forkwait Replace & and (), and takes a block
310 fopen Open multiple streams, takes a block
311 X dbg Only thing that can be used in funcs
312 [Hay Config] hay haynode For DSLs and config files
313 [Completion] compadjust compexport
314 [Data Formats] json read write
315 json8 read write
316X [Testing] assert takes an expression
317)zZXx");
318
319GLOBAL_STR(gStr19, R"zZXx(
320 Builtin Functions <a class="group-link" href="chap-builtin-func.html">builtin-func</a>
321
322
323 [Values] len() func/type() X repeat()
324 [Conversions] bool() int() float() str() list() dict()
325 X runes() X encodeRunes()
326 X bytes() X encodeBytes()
327 [Str] X strcmp() X split() shSplit()
328 [List] join() any() all()
329 [Collections] X copy() X deepCopy()
330 [Word] glob() maybe()
331 [Math] abs() max() min() X round() sum()
332 [Serialize] toJson() fromJson()
333 toJson8() fromJson8()
334X [J8 Decode] J8.Bool() J8.Int() ...
335 [Pattern] _group() _start() _end()
336 [Introspection] shvarGet() getVar() evalExpr()
337 [Hay Config] parseHay() evalHay()
338X [Hashing] sha1dc() sha256()
339)zZXx");
340
341GLOBAL_STR(gStr20, R"zZXx(The reference is divided in to "chapters", each of which has its own table of
342contents. Type:
343
344 help ysh-$CHAPTER
345
346Where $CHAPTER is one of:
347
348 front-end
349 command-lang
350 expr-lang
351 word-lang
352 builtin-cmd
353 option
354 special-var
355 type-method
356 builtin-func
357
358Example:
359
360 help ysh-expr-lang
361)zZXx");
362
363GLOBAL_STR(gStr21, R"zZXx(
364 Command Language <a class="group-link" href="chap-cmd-lang.html">cmd-lang</a>
365
366
367 [YSH Simple] typed-arg json write (x)
368 lazy-expr-arg assert [42 === x]
369 block-arg cd /tmp { echo $PWD }; cd /tmp (; ; blockexpr)
370 [YSH Cond] ysh-case case (x) { *.py { echo 'python' } }
371 ysh-if if (x > 0) { echo }
372 [YSH Iter] ysh-while while (x > 0) { echo }
373 ysh-for for i, item in (mylist) { echo }
374)zZXx");
375
376GLOBAL_STR(gStr22, R"zZXx(
377 Expression Language and Assignments <a class="group-link" href="chap-expr-lang.html">expr-lang</a>
378
379
380 [Assignment] assign =
381 aug-assign += -= *= /= **= //= %=
382 &= |= ^= <<= >>=
383 [Literals] atom-literal true false null
384 int-literal 42 65_536 0xFF 0o755 0b10
385 float-lit 3.14 1.5e-10
386 X num-suffix 42 K Ki M Mi G Gi T Ti / ms us
387 ysh-string "x is $x" $"x is $x" r'[a-z]\n'
388 u'line\n' b'byte \yff'
389 triple-quoted """ $""" r''' u''' b'''
390 str-template ^"$a and $b" for Str::replace()
391 list-literal ['one', 'two', 3] :| unquoted words |
392 dict-literal {name: 'bob'} {a, b}
393 range 1 .. n+1
394 block-expr ^(echo $PWD)
395 expr-literal ^[1 + 2*3]
396 X expr-sub $[myobj]
397 X expr-splice @[myobj]
398 [Operators] op-precedence Like Python
399 concat s1 ++ s2, L1 ++ L2
400 ysh-equals === !== ~== is, is not
401 ysh-in in, not in
402 ysh-compare < <= > >= (numbers only)
403 ysh-logical not and or
404 ysh-arith + - * / // % **
405 ysh-bitwise ~ & | ^ << >>
406 ysh-ternary '+' if x >= 0 else '-'
407 ysh-index s[0] mylist[3] mydict['key']
408 ysh-attr mydict.key
409 ysh-slice a[1:-1] s[1:-1]
410 func-call f(x, y; ...named)
411 thin-arrow mylist->pop()
412 fat-arrow mystr => startsWith('prefix')
413 match-ops ~ !~ ~~ !~~
414 [Eggex] re-literal / d+ ; re-flags ; ERE /
415 re-primitive %zero 'sq'
416 class-literal [c a-z 'abc' @str_var \\ \xFF \u0100]
417 named-class dot digit space word d s w
418 re-repeat d? d* d+ d{3} d{2,4}
419 re-compound seq1 seq2 alt1|alt2 (expr1 expr2)
420 re-capture <capture d+ as name: int>
421 re-splice Subpattern @subpattern
422 re-flags reg_icase reg_newline
423 X re-multiline ///
424)zZXx");
425
426GLOBAL_STR(gStr23, R"zZXx(
427 Front End <a class="group-link" href="chap-front-end.html">front-end</a>
428
429
430 [Usage] oils-usage ysh-usage
431 [Lexing] ascii-whitespace [ \t\r\n]
432 doc-comment ### multiline-command ...
433 [Tools] cat-em
434)zZXx");
435
436GLOBAL_STR(gStr24, R"zZXx(
437 Other Mini Languages <a class="group-link" href="chap-mini-lang.html">mini-lang</a>
438
439
440 [Patterns] glob-pat *.py
441 [Other Sublang] braces {alice,bob}@example.com
442)zZXx");
443
444GLOBAL_STR(gStr25, R"zZXx(
445 Global Shell Options <a class="group-link" href="chap-option.html">option</a>
446
447
448 [Groups] strict:all ysh:upgrade ysh:all
449 [YSH Details] opts-redefine opts-internal
450)zZXx");
451
452GLOBAL_STR(gStr26, R"zZXx(
453 Plugins and Hooks <a class="group-link" href="chap-plugin.html">plugin</a>
454
455
456 [YSH] renderPrompt()
457)zZXx");
458
459GLOBAL_STR(gStr27, R"zZXx(
460 Special Variables <a class="group-link" href="chap-special-var.html">special-var</a>
461
462
463 [YSH Vars] ARGV X ENV X _ESCAPE
464 _this_dir
465 [YSH Status] _error
466 _pipeline_status _process_sub_status
467 [YSH Tracing] SHX_indent SHX_punct SHX_pid_str
468 [YSH read] _reply
469 [History] YSH_HISTFILE
470 [Oils VM] OILS_VERSION
471 OILS_GC_THRESHOLD OILS_GC_ON_EXIT
472 OILS_GC_STATS OILS_GC_STATS_FD
473)zZXx");
474
475GLOBAL_STR(gStr28, R"zZXx(
476 Standard Library<a class="group-link" href="chap-stdlib.html">stdlib</a>
477
478
479 [Args Parser] parser Parse command line arguments
480 flag
481 arg
482 rest
483 parseArgs()
484X [Testing] describe Test harness
485X [Lines] slurp-by combine adjacent lines into cells
486X [Awk] each-line --j8 --max-jobs (Str, Template, Block) - xargs
487 each-row --max-jobs (Str, Template, Block) - xargs
488 split-by (str=\n, ifs=':', pattern=/s+/)
489 if-split-by
490 chop alias for split-by (pattern=/s+/)
491 must-match (/ <capture d+> </capture w+> /)
492 if-match
493X [Table Create] table --by-row --by-col (&place); construct/parse a table
494 table/cols cols name age - cols name:Str age:Int
495 types type Str Int
496 attr attr units - secs
497 row emit row
498 table cat concatenate TSV8
499 table align to ssv8
500 table tabify to tsv8
501 table header (cols = :|name age|, types = :|Str Int|, units = :|- secs|)
502 table slice e.g. slice (1, -1) slice (5, 7)
503 table to-tsv lose type info, and error on \t in cells
504X [Table Ops] where subset of rows; dplyr filter()
505 pick subset of columns ('select' taken by shell)
506 mutate transmute [average = count / sum] - drop the ones that are used?
507 rename (bytes='bytes', path='filename')
508 group-by add a column with a group ID [ext]
509 sort-by sort by columns; dplyr arrange() [ext]
510 summary count, sum, histogram, any, all, reduce(), etc. [ext]
511)zZXx");
512
513GLOBAL_STR(gStr29, R"zZXx(
514 Types and Methods <a class="group-link" href="chap-type-method.html">type-method</a>
515
516
517 [Atom Types] Null Bool
518 [Number Types] Int Float
519 [Str] X find() replace()
520 trim() trimStart() trimEnd()
521 startsWith() endsWith()
522 upper() lower()
523 search() leftMatch()
524 [List] List/append() pop() extend() indexOf()
525 X insert() X remove() reverse()
526 [Dict] keys() values() X get() X erase()
527 X inc() X accum()
528 [Range]
529 [Eggex]
530 [Match] group() start() end()
531 X groups() X groupDict()
532 [Place] setValue()
533 [Code Types] Expr Command
534 BuiltinFunc BoundFunc
535X [Func] name() location() toJson()
536X [Proc] name() location() toJson()
537X [Module] name() filename()
538 [IO] X eval() X captureStdout()
539 promptVal()
540 X time() X strftime()
541 X glob()
542X [Guts] heapId()
543)zZXx");
544
545GLOBAL_STR(gStr30, R"zZXx(bin/ysh is the shell with data tYpes, influenced by pYthon, JavaScript, ...
546
547Usage: ysh FLAG* SCRIPT ARG*
548 ysh FLAG* -c COMMAND ARG*
549 ysh FLAG*
550
551`bin/ysh` is the same as `bin/osh` with a the `ysh:all` option group set. So
552`bin/ysh` also accepts shell flags.
553
554 ysh -c 'echo hi'
555 ysh myscript.ysh
556 echo 'echo hi' | ysh
557)zZXx");
558
559GLOBAL_STR(gStr31, R"zZXx(
560 Word Language <a class="group-link" href="chap-word-lang.html">word-lang</a>
561
562
563 [Quotes] ysh-string "x is $x" $"x is $x" r'[a-z]\n'
564 u'line\n' b'byte \yff'
565 triple-quoted """ $""" r''' u''' b'''
566 X tagged-str "<span id=$x>"html
567 [Substitutions] expr-sub echo $[42 + a[i]]
568 expr-splice echo @[split(x)]
569 var-splice @myarray @ARGV
570 command-sub @(split command)
571 [Formatting] X ysh-printf ${x %.3f}
572 X ysh-format ${x|html}
573)zZXx");
574
575GLOBAL_STR(gStr32, R"zZXx(
576 YSH Command Language Keywords <a class="group-link" href="chap-ysh-cmd.html">ysh-cmd</a>
577
578
579 [Assignment] const var Declare variables
580 setvar setvar a[i] = 42
581 setglobal setglobal d.key = 'foo'
582 [Expression] equal = = 1 + 2*3
583 call call mylist->append(42)
584 [Definitions] proc proc p (s, ...rest) {
585 typed proc p (; typed, ...rest; n=0; b) {
586 func func f(x; opt1, opt2) { return (x + 1) }
587 ysh-return return (myexpr)
588)zZXx");
589
590GLOBAL_STR(gStr33, R"zZXx(# args.ysh
591#
592# Usage:
593# source --builtin args.sh
594#
595# parser (&spec) {
596# flag -v --verbose (help="Verbosely") # default is Bool, false
597#
598# flag -P --max-procs ('int', default=-1, doc='''
599# Run at most P processes at a time
600# ''')
601#
602# flag -i --invert ('bool', default=true, doc='''
603# Long multiline
604# Description
605# ''')
606#
607# arg src (help='Source')
608# arg dest (help='Dest')
609# arg times (help='Foo')
610#
611# rest files
612# }
613#
614# var args = parseArgs(spec, ARGV)
615#
616# echo "Verbose $[args.verbose]"
617
618# TODO: See list
619# - It would be nice to keep `flag` and `arg` private, injecting them into the
620# proc namespace only within `Args`
621# - We need "type object" to replace the strings 'int', 'bool', etc.
622# - flag builtin:
623# - handle only long flag or only short flag
624# - flag aliases
625
626proc parser (; place ; ; block_def) {
627 ## Create an args spec which can be passed to parseArgs.
628 ##
629 ## Example:
630 ##
631 ## # NOTE: &spec will create a variable named spec
632 ## parser (&spec) {
633 ## flag -v --verbose ('bool')
634 ## }
635 ##
636 ## var args = parseArgs(spec, ARGV)
637
638 var p = {flags: [], args: []}
639 ctx push (p; ; block_def)
640
641 # Validate that p.rest = [name] or null and reduce p.rest into name or null.
642 if ('rest' in p) {
643 if (len(p.rest) > 1) {
644 error '`rest` was called more than once' (code=3)
645 } else {
646 setvar p.rest = p.rest[0]
647 }
648 } else {
649 setvar p.rest = null
650 }
651
652 var names = {}
653 for items in ([p.flags, p.args]) {
654 for x in (items) {
655 if (x.name in names) {
656 error "Duplicate flag/arg name $[x.name] in spec" (code=3)
657 }
658
659 setvar names[x.name] = null
660 }
661 }
662
663 # TODO: what about `flag --name` and then `arg name`?
664
665 call place->setValue(p)
666}
667
668proc flag (short, long ; type='bool' ; default=null, help=null) {
669 ## Declare a flag within an `arg-parse`.
670 ##
671 ## Examples:
672 ##
673 ## arg-parse (&spec) {
674 ## flag -v --verbose
675 ## flag -n --count ('int', default=1)
676 ## flag -f --file ('str', help="File to process")
677 ## }
678
679 # bool has a default of false, not null
680 if (type === 'bool' and default === null) {
681 setvar default = false
682 }
683
684 # TODO: validate `type`
685
686 # TODO: Should use "trimPrefix"
687 var name = long[2:]
688
689 ctx emit flags ({short, long, name, type, default, help})
690}
691
692proc arg (name ; ; help=null) {
693 ## Declare a positional argument within an `arg-parse`.
694 ##
695 ## Examples:
696 ##
697 ## arg-parse (&spec) {
698 ## arg name
699 ## arg config (help="config file path")
700 ## }
701
702 ctx emit args ({name, help})
703}
704
705proc rest (name) {
706 ## Take the remaining positional arguments within an `arg-parse`.
707 ##
708 ## Examples:
709 ##
710 ## arg-parse (&grepSpec) {
711 ## arg query
712 ## rest files
713 ## }
714
715 # We emit instead of set to detect multiple invocations of "rest"
716 ctx emit rest (name)
717}
718
719func parseArgs(spec, argv) {
720 ## Given a spec created by `parser`. Parse an array of strings `argv` per
721 ## that spec.
722 ##
723 ## See `parser` for examples of use.
724
725 var i = 0
726 var positionalPos = 0
727 var argc = len(argv)
728 var args = {}
729 var rest = []
730
731 var value
732 var found
733 while (i < argc) {
734 var arg = argv[i]
735 if (arg->startsWith('-')) {
736 setvar found = false
737
738 for flag in (spec.flags) {
739 if ( (flag.short and flag.short === arg) or
740 (flag.long and flag.long === arg) ) {
741 case (flag.type) {
742 ('bool') | (null) { setvar value = true }
743 int {
744 setvar i += 1
745 if (i >= len(argv)) {
746 error "Expected integer after '$arg'" (code=2)
747 }
748
749 try { setvar value = int(argv[i]) }
750 if (_status !== 0) {
751 error "Expected integer after '$arg', got '$[argv[i]]'" (code=2)
752 }
753 }
754 }
755
756 setvar args[flag.name] = value
757 setvar found = true
758 break
759 }
760 }
761
762 if (not found) {
763 error "Unknown flag '$arg'" (code=2)
764 }
765 } elif (positionalPos >= len(spec.args)) {
766 if (not spec.rest) {
767 error "Too many arguments, unexpected '$arg'" (code=2)
768 }
769
770 call rest->append(arg)
771 } else {
772 var pos = spec.args[positionalPos]
773 setvar positionalPos += 1
774 setvar value = arg
775 setvar args[pos.name] = value
776 }
777
778 setvar i += 1
779 }
780
781 if (spec.rest) {
782 setvar args[spec.rest] = rest
783 }
784
785 # Set defaults for flags
786 for flag in (spec.flags) {
787 if (flag.name not in args) {
788 setvar args[flag.name] = flag.default
789 }
790 }
791
792 # Raise error on missing args
793 for arg in (spec.args) {
794 if (arg.name not in args) {
795 error "Usage Error: Missing required argument $[arg.name]" (code=2)
796 }
797 }
798
799 return (args)
800}
801)zZXx");
802
803GLOBAL_STR(gStr34, R"zZXx(func identity(x) {
804 ## The identity function. Returns its argument.
805
806 return (x)
807}
808)zZXx");
809
810GLOBAL_STR(gStr35, R"zZXx(func any(list) {
811 ## Returns true if any value in the list is truthy.
812 ##
813 ## If the list is empty, return false.
814
815 for item in (list) {
816 if (item) {
817 return (true)
818 }
819 }
820 return (false)
821}
822
823func all(list) {
824 ## Returns true if all values in the list are truthy.
825 ##
826 ## If the list is empty, return true.
827
828 for item in (list) {
829 if (not item) {
830 return (false)
831 }
832 }
833 return (true)
834}
835
836func sum(list; start=0) {
837 ## Computes the sum of all elements in the list.
838 ##
839 ## Returns 0 for an empty list.
840
841 var sum = start
842 for item in (list) {
843 setvar sum += item
844 }
845 return (sum)
846}
847)zZXx");
848
849GLOBAL_STR(gStr36, R"zZXx(func __math_select(list, cmp) {
850 ## Internal helper for `max` and `min`.
851 ##
852 ## NOTE: If `list` is empty, then an error is thrown.
853
854 if (len(list) === 0) {
855 error "Unexpected empty list" (code=3)
856 }
857
858 if (len(list) === 1) {
859 return (list[0])
860 }
861
862 var match = list[0]
863 for i in (1 .. len(list)) {
864 setvar match = cmp(list[i], match)
865 }
866 return (match)
867}
868
869func max(...args) {
870 ## Compute the maximum of 2 or more values.
871 ##
872 ## `max` takes two different signatures:
873 ## - `max(a, b)` to return the maximum of `a`, `b`
874 ## - `max(list)` to return the greatest item in the `list`
875 ##
876 ## So, for example:
877 ##
878 ## max(1, 2) # => 2
879 ## max([1, 2, 3]) # => 3
880
881 case (len(args)) {
882 (1) { return (__math_select(args[0], max)) }
883 (2) {
884 if (args[0] > args[1]) {
885 return (args[0])
886 } else {
887 return (args[1])
888 }
889 }
890 (else) { error "max expects 1 or 2 args" (code=3) }
891 }
892}
893
894func min(...args) {
895 ## Compute the minimum of 2 or more values.
896 ##
897 ## `min` takes two different signatures:
898 ## - `min(a, b)` to return the minimum of `a`, `b`
899 ## - `min(list)` to return the least item in the `list`
900 ##
901 ## So, for example:
902 ##
903 ## min(2, 3) # => 2
904 ## max([1, 2, 3]) # => 1
905
906 case (len(args)) {
907 (1) { return (__math_select(args[0], min)) }
908 (2) {
909 if (args[0] < args[1]) {
910 return (args[0])
911 } else {
912 return (args[1])
913 }
914 }
915 (else) { error "min expects 1 or 2 args" (code=3) }
916 }
917}
918
919func abs(x) {
920 ## Compute the absolute (positive) value of a number (float or int).
921
922 if (x < 0) {
923 return (-x)
924 } else {
925 return (x)
926 }
927}
928)zZXx");
929
930GLOBAL_STR(gStr37, R"zZXx(# Can we define methods in pure YSH?
931#
932# (mylist->find(42) !== -1)
933#
934# instead of
935#
936# ('42' in mylist)
937#
938# Because 'in' is for Dict
939
940func find (haystack List, needle) {
941 for i, x in (haystack) {
942 if (x === needle) {
943 return (i)
944 }
945 }
946 return (-1)
947}
948)zZXx");
949
950GLOBAL_STR(gStr38, R"zZXx(# Library to turn a shell file into a "BYO test server"
951#
952# Usage:
953#
954# # from both bash and OSH
955# if test -z "$LIB_OSH"; then LIB_OSH=stdlib/osh; fi
956# source $LIB_OSH/byo-server-lib.sh
957#
958# The client creates a clean process state and directory state for each tests.
959#
960# (This file requires compgen -A, and maybe declare -f, so it's not POSIX
961# shell.)
962
963# TODO: How do I get stdlib/two.sh
964log() {
965 echo "$@" >& 2
966}
967
968die() {
969 log "$0: fatal: $@"
970 exit 1
971}
972
973byo-maybe-run() {
974 local command=${BYO_COMMAND:-}
975
976 case $command in
977 '')
978 # Do nothing if it's not specified
979 return
980 ;;
981
982 detect)
983 # all the commands supported, except 'detect'
984 echo list-tests
985 echo run-test
986
987 exit 66 # ASCII code for 'B' - what the protocol specifies
988 ;;
989
990 list-tests)
991 # bash extension that OSH also implements
992 compgen -A function | grep '^test-'
993 exit 0
994 ;;
995
996 run-test)
997 local test_name=${BYO_ARG:-}
998 if test -z "$test_name"; then
999 die "BYO run-test: Expected BYO_ARG"
1000 fi
1001
1002 # Shell convention: we name functions test-*
1003 $test_name
1004
1005 # Only run if not set -e. Either way it's equivalent
1006 exit $?
1007 ;;
1008
1009 *)
1010 die "Invalid BYO command '$command'"
1011 ;;
1012 esac
1013
1014 # Do nothing if BYO_COMMAND is not set.
1015 # The program continues to its "main".
1016}
1017
1018byo-must-run() {
1019 local command=${BYO_COMMAND:-}
1020 if test -z "$command"; then
1021 die "Expected BYO_COMMAND= in environment"
1022 fi
1023
1024 byo-maybe-run
1025}
1026)zZXx");
1027
1028GLOBAL_STR(gStr39, R"zZXx(#!/usr/bin/env bash
1029#
1030# Testing library for bash and OSH.
1031#
1032# Capture status/stdout/stderr, and nq-assert those values.
1033
1034source stdlib/osh/two.sh
1035
1036nq-assert() {
1037 ### Must be run with errexit off
1038
1039 if ! test "$@"; then
1040 die "line ${BASH_LINENO[0]}: nq-assert '$@' failed"
1041 fi
1042}
1043
1044nq-capture() {
1045 ### capture status and stdout
1046
1047 local -n out_status=$1
1048 local -n out_stdout=$2
1049 shift 2
1050
1051 local __status
1052 local __stdout
1053
1054 # Tricky: turn errexit off so we can capture it, but turn it on against
1055 set +o errexit
1056 __stdout=$(set -o errexit; "$@")
1057 __status=$?
1058 set -o errexit
1059
1060 out_status=$__status
1061 out_stdout=$__stdout
1062}
1063
1064nq-capture-2() {
1065 ### capture status and stderr
1066
1067 # This is almost identical to the above
1068
1069 local -n out_status=$1
1070 local -n out_stderr=$2
1071 shift 2
1072
1073 local __status
1074 local __stderr
1075
1076 # Tricky: turn errexit off so we can capture it, but turn it on against
1077 set +o errexit
1078 __stderr=$(set -o errexit; "$@" 2>&1)
1079 __status=$?
1080 set -o errexit
1081
1082 out_status=$__status
1083 out_stderr=$__stderr
1084}
1085
1086_demo-stderr() {
1087 echo zzz "$@" >& 2
1088 return 99
1089}
1090
1091test-nq-capture() {
1092 local status stdout
1093 nq-capture status stdout \
1094 echo hi
1095
1096 nq-assert 0 = "$status"
1097 nq-assert 'hi' = "$stdout"
1098
1099 local stderr
1100 nq-capture-2 status stderr \
1101 _demo-stderr yyy
1102
1103 #echo "stderr: [$stderr]"
1104
1105 nq-assert 99 = "$status"
1106 nq-assert 'zzz yyy' = "$stderr"
1107
1108 nq-capture status stdout \
1109 _demo-stderr aaa
1110
1111 #echo "stderr: [$stderr]"
1112
1113 nq-assert 99 = "$status"
1114 nq-assert '' = "$stdout"
1115}
1116
1117name=$(basename $0)
1118if test "$name" = 'testing.sh'; then
1119 "$@"
1120fi
1121)zZXx");
1122
1123GLOBAL_STR(gStr40, R"zZXx(# Two functions I actually use, all the time.
1124#
1125# To keep depenedencies small, this library will NEVER grow other functions
1126# (and is named to imply that.)
1127#
1128# Usage:
1129# source --builtin two.sh
1130#
1131# Examples:
1132# log 'hi'
1133# die 'expected a number'
1134
1135log() {
1136 ### Write a message to stderr.
1137 echo "$@" >&2
1138}
1139
1140die() {
1141 ### Write an error message with the script name, and exit with status 1.
1142 log "$0: fatal: $@"
1143 exit 1
1144}
1145
1146)zZXx");
1147
1148GLOBAL_STR(gStr41, R"zZXx(# These were helpful while implementing args.ysh
1149# Maybe we will want to export them in a prelude so that others can use them too?
1150#
1151# Prior art: Rust has `todo!()` which is quite nice. Other languages allow
1152# users to `raise NotImplmentedError()`.
1153
1154# Andy comments:
1155# - 'pass' can be : or true in shell. It's a little obscure / confusing, but
1156# there is an argument for minimalism. Although I prefer words like 'true',
1157# and that already means something.
1158# - UPDATE: we once took 'pass' as a keyword, but users complained because
1159# there is a command 'pass'. So we probably can't have this by default.
1160# Need to discuss source --builtin.
1161
1162# - todo could be more static? Rust presumably does it at compile time
1163
1164proc todo () {
1165 ## Raises a not implemented error when run.
1166 error ("TODO: not implemented") # TODO: is error code 1 ok?
1167}
1168
1169proc pass () {
1170 ## Use when you want to temporarily leave a block empty.
1171 _ null
1172}
1173)zZXx");
1174
1175GLOBAL_STR(gStr42, R"zZXx(# stream.ysh
1176#
1177# Usage:
1178# source --builtin stream.ysh
1179#
1180# For reading lines, decoding, extracting, splitting
1181
1182# make this file a test server
1183source --builtin osh/byo-server.sh
1184
1185source --builtin args.ysh
1186
1187proc slurp-by (; num_lines) {
1188 # TODO: (stdin)
1189 for line in <> {
1190 echo TODO
1191 }
1192}
1193
1194# Note:
1195# - these are all the same algorithm
1196# - also word, block, etc. are all optional
1197
1198proc each-line (...words; template=null; ; block=null) {
1199 # TODO:
1200 # parse --j8 --max-jobs flag
1201
1202 # parse template_str as string
1203 # TODO: this is dangerous though ... because you can execute code
1204 # I think you need a SAFE version
1205
1206 # evaluate template string expression - I guess that allows $(echo hi) and so
1207 # forth
1208
1209 # evaluate block with _line binding
1210 # block: execute in parallel with --max-jobs
1211
1212 for line in <> {
1213 echo TODO
1214 }
1215}
1216
1217proc test-each-line {
1218 echo 'TODO: need basic test runner'
1219
1220 # ysh-tool test stream.ysh
1221 #
1222 # Col
1223
1224
1225}
1226
1227proc each-row (; ; block) {
1228 echo TODO
1229}
1230
1231proc split-by (; ifs=null; block) {
1232 echo TODO
1233}
1234
1235proc if-split-by (; ifs=null; block) {
1236 echo TODO
1237}
1238
1239proc chop () {
1240 ### alias for if-split-by
1241 echo TODO
1242}
1243
1244proc must-match (; pattern; block) {
1245 echo TODO
1246}
1247
1248proc if-match (; pattern; block) {
1249 echo TODO
1250}
1251
1252# Protocol:
1253#
1254# - The file lists its tests the "actions"
1255# - Then the test harness runs them
1256# - But should it be ENV vars
1257#
1258# - BYO_LIST_TESTS=1
1259# - BYO_RUN_TEST=foo
1260# - $PWD is a CLEAN temp dir, the process doesn't have to do anything
1261
1262# - silent on success, but prints file on output
1263# - OK this makes sense
1264#
1265# The trivial test in Python:
1266#
1267# from test import byo
1268# byo.maybe_main()
1269#
1270# bash library:
1271# source --builtin byo-server.sh
1272#
1273# byo-maybe-main # reads env variables, and then exits
1274#
1275# source --builtin assertions.ysh
1276#
1277# assert-ok 'echo hi'
1278# assert-stdout 'hi' 'echo -n hi'
1279#
1280# "$@"
1281#
1282# Run all tests
1283# util/byo-client.sh run-tests $YSH stdlib/table.ysh
1284# util/byo-client.sh run-tests -f x $YSH stdlib/table.ysh
1285
1286# Clean process
1287# Clean working dir
1288
1289#
1290# Stream Protocol:
1291# #.byo - is this she-dot, that's for a file
1292# Do we need metadata?
1293#
1294
1295# The harness
1296#
1297# It's process based testing.
1298#
1299# Test runner process: bash or OSH (unlike sharness!)
1300# Tested process: any language - bash,
1301#
1302# Key point: you don't have to quote shell code?
1303
1304list-byo-tests() {
1305 echo TODO
1306}
1307
1308run-byo-tests() {
1309 # source it
1310 echo TODO
1311}
1312
1313byo-maybe-run
1314)zZXx");
1315
1316GLOBAL_STR(gStr43, R"zZXx(# table.ysh - Library for tables.
1317#
1318# Usage:
1319# source --builtin table.ysh
1320
1321# make this file a test server
1322source --builtin osh/byo-server.sh
1323
1324proc table (...words; place; ; block) {
1325 var n = len(words)
1326
1327 # TODO: parse flags
1328 #
1329 # --by-row
1330 # --by-col
1331 #
1332 # Place is optional
1333
1334 if (n === 0) {
1335 echo TODO
1336 return
1337 }
1338
1339 var action = words[0]
1340
1341 # textual operations
1342 case (action) {
1343 cat {
1344 echo todo
1345 }
1346 align {
1347 echo todo
1348 }
1349 tabify {
1350 echo todo
1351 }
1352 tabify {
1353 echo todo
1354 }
1355 header {
1356 echo todo
1357 }
1358 slice {
1359 # this has typed args
1360 # do we do some sort of splat?
1361 echo todo
1362 }
1363 to-tsv {
1364 echo todo
1365 }
1366 }
1367
1368 echo TODO
1369}
1370
1371proc test-table {
1372 return
1373
1374 table (&files1) {
1375 cols num_bytes path
1376 type Int Str
1377
1378 row 10 README.md
1379 row 12 main.py
1380
1381 row (12, 'lib.py')
1382 row (num_bytes=12, path='util.py')
1383 }
1384
1385 # 2 columns - The default is by column?
1386 assert ['Dict' === type(files1)]
1387 assert [2 === len(files1)]
1388
1389 # Same table
1390 table --by-row (&files2) {
1391 cols num_bytes path
1392 type Int Str
1393
1394 row 10 README.md
1395 row 12 main.py
1396
1397 row (12, 'lib.py')
1398 row (num_bytes=12, path='util.py')
1399 }
1400
1401 # 4 rows
1402 assert ['List' === type(files2)]
1403 assert [4 === len(files2)]
1404}
1405
1406# "subcommands" of the dialect
1407
1408proc cols (...names) {
1409 # cols name age
1410 echo TODO
1411}
1412
1413proc types (...types) {
1414 # types - Int? Str?
1415 echo TODO
1416}
1417
1418proc attr (name; ...values) {
1419 # attr units ('-', 'secs')
1420 echo TODO
1421}
1422
1423# is this allowed outside table {} blocks too?
1424proc row {
1425 echo TODO
1426}
1427
1428#
1429# dplyr names
1430#
1431
1432# TODO: can we parse select?
1433
1434proc where {
1435 echo
1436}
1437
1438# TODO: should be able to test argv[0] or something
1439# Or pass to _mutate-transmute
1440
1441proc mutate {
1442 echo TODO
1443}
1444
1445proc transmute {
1446 echo TODO
1447}
1448
1449proc rename {
1450 echo TODO
1451}
1452
1453proc group-by {
1454 echo TODO
1455}
1456
1457proc sort-by {
1458 echo TODO
1459}
1460
1461proc summary {
1462 echo TODO
1463}
1464
1465byo-maybe-run
1466)zZXx");
1467
1468GLOBAL_STR(gStr44, R"zZXx(# testing.ysh
1469#
1470# Usage:
1471# source --builtin testing.sh
1472#
1473# func f(x) { return (x + 1) }
1474#
1475# describe foo {
1476# assert (43 === f(42))
1477# }
1478#
1479# if is-main {
1480# run-tests @ARGV # --filter
1481# }
1482
1483module stdlib/testing || return 0
1484
1485source --builtin args.ysh
1486
1487proc assert ( ; cond ; fail_message='default fail message') {
1488 echo 'hi from assert'
1489
1490 = cond
1491
1492 # I think this might be ready now?
1493
1494 var val = evalExpr(cond)
1495
1496 echo
1497 echo 'value'
1498 = val
1499 pp line (val)
1500
1501 = fail_message
1502
1503 if (val) {
1504 echo 'OK'
1505 } else {
1506 var m = evalExpr(fail_message)
1507 echo "FAIL - this is where we extract the string - $m"
1508 }
1509}
1510
1511proc test-assert {
1512 var x = 42
1513 assert [42 === x]
1514}
1515
1516proc test-expr ( ; expr ) {
1517 echo 'expr'
1518 pp line (expr)
1519}
1520
1521proc test-named ( ; ; n=^[99] ) {
1522 echo 'n'
1523 pp line (n)
1524}
1525
1526# What happens when there are duplicate test IDs?
1527#
1528# Also I think filter by "$test_id/$case_id"
1529
1530proc __it (case_id ; ; ; block) {
1531 # This uses a clean directory
1532 echo TODO
1533}
1534
1535# is this accessible to users?
1536# It can contain a global list of things to run
1537
1538# Naming convention: a proc named 'describe' mutates a global named _describe?
1539# Or maybe _describe_list ?
1540
1541var _describe_list = []
1542
1543proc describe (test_id ; ; ; block) {
1544 echo describe
1545 #= desc
1546
1547 # TODO:
1548 # - need append
1549 # - need ::
1550 # _ _describe->append(cmd)
1551 #
1552 # Need to clean this up
1553 # append (_describe, cmd) # does NOT work!
1554
1555 call _describe_list->append(block)
1556}
1557
1558proc Args {
1559 echo TODO
1560}
1561
1562# Problem: this creates a global variable?
1563Args (&spec) {
1564 flag --filter 'Regex of test descriptions'
1565}
1566
1567proc run-tests {
1568 var opt, i = parseArgs(spec, ARGV)
1569
1570 # TODO:
1571 # - parse --filter foo, which you can use eggex for!
1572
1573 for cmd in (_describe) {
1574 # TODO: print filename and 'describe' name?
1575 try {
1576 eval (cmd)
1577 }
1578 if (_status !== 0) {
1579 echo 'failed'
1580 }
1581 }
1582}
1583)zZXx");
1584
1585
1586
1587TextFile array[] = {
1588 {.rel_path = "_devbuild/help/data-errors", .contents = gStr0},
1589 {.rel_path = "_devbuild/help/data-front-end", .contents = gStr1},
1590 {.rel_path = "_devbuild/help/data-j8-notation", .contents = gStr2},
1591 {.rel_path = "_devbuild/help/help", .contents = gStr3},
1592 {.rel_path = "_devbuild/help/oils-usage", .contents = gStr4},
1593 {.rel_path = "_devbuild/help/osh-builtin-cmd", .contents = gStr5},
1594 {.rel_path = "_devbuild/help/osh-chapters", .contents = gStr6},
1595 {.rel_path = "_devbuild/help/osh-cmd-lang", .contents = gStr7},
1596 {.rel_path = "_devbuild/help/osh-front-end", .contents = gStr8},
1597 {.rel_path = "_devbuild/help/osh-mini-lang", .contents = gStr9},
1598 {.rel_path = "_devbuild/help/osh-option", .contents = gStr10},
1599 {.rel_path = "_devbuild/help/osh-osh-assign", .contents = gStr11},
1600 {.rel_path = "_devbuild/help/osh-plugin", .contents = gStr12},
1601 {.rel_path = "_devbuild/help/osh-special-var", .contents = gStr13},
1602 {.rel_path = "_devbuild/help/osh-stdlib", .contents = gStr14},
1603 {.rel_path = "_devbuild/help/osh-type-method", .contents = gStr15},
1604 {.rel_path = "_devbuild/help/osh-usage", .contents = gStr16},
1605 {.rel_path = "_devbuild/help/osh-word-lang", .contents = gStr17},
1606 {.rel_path = "_devbuild/help/ysh-builtin-cmd", .contents = gStr18},
1607 {.rel_path = "_devbuild/help/ysh-builtin-func", .contents = gStr19},
1608 {.rel_path = "_devbuild/help/ysh-chapters", .contents = gStr20},
1609 {.rel_path = "_devbuild/help/ysh-cmd-lang", .contents = gStr21},
1610 {.rel_path = "_devbuild/help/ysh-expr-lang", .contents = gStr22},
1611 {.rel_path = "_devbuild/help/ysh-front-end", .contents = gStr23},
1612 {.rel_path = "_devbuild/help/ysh-mini-lang", .contents = gStr24},
1613 {.rel_path = "_devbuild/help/ysh-option", .contents = gStr25},
1614 {.rel_path = "_devbuild/help/ysh-plugin", .contents = gStr26},
1615 {.rel_path = "_devbuild/help/ysh-special-var", .contents = gStr27},
1616 {.rel_path = "_devbuild/help/ysh-stdlib", .contents = gStr28},
1617 {.rel_path = "_devbuild/help/ysh-type-method", .contents = gStr29},
1618 {.rel_path = "_devbuild/help/ysh-usage", .contents = gStr30},
1619 {.rel_path = "_devbuild/help/ysh-word-lang", .contents = gStr31},
1620 {.rel_path = "_devbuild/help/ysh-ysh-cmd", .contents = gStr32},
1621 {.rel_path = "stdlib/args.ysh", .contents = gStr33},
1622 {.rel_path = "stdlib/funcs.ysh", .contents = gStr34},
1623 {.rel_path = "stdlib/list.ysh", .contents = gStr35},
1624 {.rel_path = "stdlib/math.ysh", .contents = gStr36},
1625 {.rel_path = "stdlib/methods.ysh", .contents = gStr37},
1626 {.rel_path = "stdlib/osh/byo-server.sh", .contents = gStr38},
1627 {.rel_path = "stdlib/osh/no-quotes.sh", .contents = gStr39},
1628 {.rel_path = "stdlib/osh/two.sh", .contents = gStr40},
1629 {.rel_path = "stdlib/prelude.ysh", .contents = gStr41},
1630 {.rel_path = "stdlib/stream.ysh", .contents = gStr42},
1631 {.rel_path = "stdlib/table.ysh", .contents = gStr43},
1632 {.rel_path = "stdlib/testing.ysh", .contents = gStr44},
1633
1634 {.rel_path = nullptr, .contents = nullptr},
1635};
1636
1637} // namespace embedded_file
1638
1639TextFile* gEmbeddedFiles = embedded_file::array; // turn array into pointer