-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[doc] Move help text to ref/chap-front-end.md
Add CSS color to show the difference between OSH and YSH help topics.
- Loading branch information
Andy C
committed
Aug 5, 2023
1 parent
0db73c1
commit bf37374
Showing
11 changed files
with
175 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
--- | ||
in_progress: yes | ||
css_files: ../../web/base.css ../../web/manual.css ../../web/help.css ../../web/toc.css | ||
body_css_class: width40 help-body | ||
default_highlighter: oil-sh | ||
--- | ||
|
||
Oils Reference: Front End | ||
=== | ||
|
||
<div id="toc"> | ||
</div> | ||
|
||
## Usage | ||
|
||
<h3 id="bundle-usage" class="osh-ysh-topic">App Bundle Usage</h3> | ||
|
||
Usage: oils-for-unix MAIN_NAME [ARG]... | ||
MAIN_NAME [ARG]... | ||
|
||
oils-for-unix behaves like busybox. If it's invoked through a symlink, e.g. 'osh', | ||
then it behaves like that binary. Otherwise, the binary name can be passed as | ||
the first argument, e.g.: | ||
|
||
oils-for-unix osh -c 'echo hi' | ||
|
||
<h3 id="osh-usage" class="osh-topic"><code>bin/osh</code> Usage</h3> | ||
|
||
Usage: osh [OPTION]... SCRIPT [ARG]... | ||
osh [OPTION]... -c COMMAND [ARG]... | ||
|
||
The command line accepted by `bin/osh` is compatible with `/bin/sh` and `bash`. | ||
|
||
osh -c 'echo hi' | ||
osh myscript.sh | ||
echo 'echo hi' | osh | ||
|
||
It also has a few enhancements: | ||
|
||
osh -n -c 'hello' # pretty-print the AST | ||
osh --ast-format text -n -c 'hello' # print it full | ||
|
||
osh accepts POSIX sh flags, with these additions: | ||
|
||
-n parse the program but don't execute it. Print the AST. | ||
--ast-format what format the AST should be in | ||
|
||
<h3 id="ysh-usage" class="ysh-topic"><code>bin/ysh</code> Usage</h3> | ||
|
||
Usage: ysh [OPTION]... SCRIPT [ARG]... | ||
ysh [OPTION]... -c COMMAND [ARG]... | ||
|
||
`bin/ysh` is the same as `bin/osh` with a the `ysh:all` option group set. So | ||
`bin/ysh` also accepts shell flags. | ||
|
||
ysh -c 'echo hi' | ||
ysh myscript.ysh | ||
echo 'echo hi' | ysh | ||
|
||
|
||
<h3 id="config" class="osh-ysh-topic">Configuring the Shell</h3> | ||
|
||
If the --rcfile flag is specified, that file will be executed on startup. | ||
Otherwise: | ||
|
||
- `bin/osh` runs `~/.config/oils/oshrc` | ||
- `bin/ysh` runs `~/.config/oils/yshrc` | ||
|
||
Pass --rcfile /dev/null or --norc to disable the startup file. | ||
|
||
If the --rcdir flag is specified, files in that folder will be executed on | ||
startup. | ||
Otherwise: | ||
|
||
- `bin/osh` runs everything in `~/.config/oils/oshrc.d/` | ||
- `bin/ysh` runs everything in `~/.config/oils/yshrc.d/` | ||
|
||
Pass --norc to disable the startup directory. | ||
|
||
<h3 id="startup" class="osh-ysh-topic">Startup Files</h3> | ||
|
||
History is read? | ||
|
||
## Lexing | ||
|
||
<h3 id="comment" class="osh-ysh-topic">Comments</h3> | ||
|
||
A comment starts with `#` and goes until the end of the line. | ||
|
||
echo hi # print a greeting | ||
|
||
<h3 id="line-continuation" class="osh-ysh-topic">Line Continuation</h3> | ||
|
||
A backslash `\` at the end of a line continues the line without executing it: | ||
|
||
ls /usr/bin \ | ||
/usr/lib \ | ||
~/src # A single command split over three lines | ||
|
||
<h3 id="doc-comment" class="ysh-topic">Doc Comments</h3> | ||
|
||
Doc comments look like this: | ||
|
||
proc deploy { | ||
### Deploy the app | ||
echo hi | ||
} | ||
|
||
<h3 id="multiline-command" class="ysh-topic">Multi-Line Command</h3> | ||
|
||
The ... prefix starts a single command over multiple lines. It allows writing | ||
long commands without \ continuation lines, and the resulting limitations on | ||
where you can put comments. | ||
|
||
Single command example: | ||
|
||
... chromium-browser | ||
# comment on its own line | ||
--no-proxy-server | ||
--incognito # comment to the right | ||
; | ||
|
||
Long pipelines and and-or chains: | ||
|
||
... find . | ||
# exclude tests | ||
| grep -v '_test.py' | ||
| xargs wc -l | ||
| sort -n | ||
; | ||
|
||
... ls / | ||
&& ls /bin | ||
&& ls /lib | ||
|| error "oops" | ||
; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.