Skip to content

Commit

Permalink
[doc/ref] Use <pre> for topics embedded in help
Browse files Browse the repository at this point in the history
This makes them look consistent on the terminal and in HTML (at some
cost in HTML readability).

I think most topics will be HTML.
  • Loading branch information
Andy C committed Aug 5, 2023
1 parent a1ec601 commit 2e999ea
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 23 deletions.
12 changes: 10 additions & 2 deletions doc/osh-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -989,22 +989,30 @@ Unimplemented.

#### help

<!-- pre-formatted for help builtin -->

```
The help builtin
Usage: help TOPIC?
Examples:
help # this help
help osh # chapters for osh or ysh
help ysh
help command-lang # list sections in chapter
help osh-command-lang # same but more explicit
help TOPIC # show help on a given topic

help usage # same as osh --help, ysh --help
help osh-usage # more explicit
help ysh-usage # more explicit
All docs, including this reference:
https://www.oilshell.org/release/$VERSION/doc/
```

#### hash

Expand Down
45 changes: 34 additions & 11 deletions doc/ref/chap-front-end.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,36 @@ Oils Reference: Front End

<h3 id="bundle-usage" class="osh-ysh-topic">App Bundle Usage</h3>

Usage: oils-for-unix MAIN_NAME [ARG]...
MAIN_NAME [ARG]...
<!-- pre-formatted for help builtin -->

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 is an executable that contains OSH, YSH, and more.
oils-for-unix osh -c 'echo hi'
Usage: oils-for-unix MAIN_NAME ARG*
MAIN_NAME ARG*
It behaves like busybox. If it's invoked through a symlink like 'osh', then it
behaves like that command.
ysh -c 'echo hi'
Otherwise, the command name can be passed as the first argument, e.g.:
oils-for-unix ysh -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]...
<!-- pre-formatted for help builtin -->

The command line accepted by `bin/osh` is compatible with `/bin/sh` and `bash`.
```
osh is compatible with POSIX shell, bash, and more.
Usage: osh FLAG* SCRIPT ARG*
osh FLAG* -c COMMAND ARG*
osh FLAG*
The command line accepted by `bin/osh` is compatible with /bin/sh and bash.
osh -c 'echo hi'
osh myscript.sh
Expand All @@ -44,18 +59,26 @@ 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]...
<!-- pre-formatted for help builtin -->

```
ysh is the shell with data tYpes, influenced by pYthon, JavaScript, Lisp, ...
Usage: ysh FLAG* SCRIPT ARG*
ysh FLAG* -c COMMAND ARG*
ysh FLAG*
`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>
Expand Down
11 changes: 6 additions & 5 deletions doc/ref/osh.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
OSH Reference

Chapters:
The reference is divided in to "chapters", each of which has its own table of
contents. Type:

help osh-$chapter

Where $chapter is one of:

overview
command-lang
Expand All @@ -12,7 +17,3 @@ Chapters:
env
special
plugin

To see topics in a chapter:

help osh-$chapter
11 changes: 6 additions & 5 deletions doc/ref/ysh.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
YSH Reference

Chapters:
The reference is divided in to "chapters", each of which has its own table of
contents. Type:

help ysh-$chapter

Where $chapter is one of:

overview
command-lang
Expand All @@ -11,7 +16,3 @@ Chapters:
env
special
lib

To see topics in a chapter:

help ysh-$chapter

0 comments on commit 2e999ea

Please sign in to comment.