Skip to content

Commit

Permalink
Update documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmacinnis committed Jul 28, 2016
1 parent edcb952 commit 194f044
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -22,7 +22,7 @@ used interchangeably. This homoiconic nature also allows oh to support
fexprs which, in turn, allow oh to be easily extended.
In fact, much of oh is written in oh. (Currently, 531
of 6427 lines of code are written in oh with an
additional 840 lines of go generated by 175 lines
additional 840 lines of Go generated by 175 lines
of oh).

For a detailed comparison to other Unix shells see: [Comparing oh to other Unix Shells](https://htmlpreview.github.io/?https://raw.githubusercontent.com/michaelmacinnis/oh/master/doc/comparison.html)
Expand Down
2 changes: 1 addition & 1 deletion bin/generate.oh
Expand Up @@ -20,7 +20,7 @@ block {
echo
echo "## In fact, much of oh is written in oh. (Currently, ${oh-loc}"
echo "## of ${total-loc} lines of code are written in oh with an"
echo "## additional ${go-gloc} lines of go generated by ${oh-gloc} lines"
echo "## additional ${go-gloc} lines of Go generated by ${oh-gloc} lines"
echo "## of oh)."
echo "##"
} > line-count-file
Expand Down
18 changes: 9 additions & 9 deletions doc/manual.md
Expand Up @@ -83,7 +83,7 @@ including the empty string. In general patterns are specified as follows.
|:-------:|:---------------------------------------------------------------|
| `*` | Matches any sequence of zero or more characters. |
| `?` | Matches any single character. |
| `[...]` | Matches any one of the characters enclosed. A pair separated by a minus will match a lexical range of characters.|
| `[...]` | Matches any one of the characters enclosed. A pair separated by a minus will match a lexical range of characters. If the first enclosed character is a `^` the match is negated. |

For example,

Expand Down Expand Up @@ -404,15 +404,15 @@ If statements can be chained:

#### While

The command,
Oh has a fairly standard pre-test loop. The commands,

define x = 0
while (lt x 10) {
write x
set x: add x 1
}

produces the output,
produce the output,

0
1
Expand Down Expand Up @@ -485,7 +485,7 @@ Once defined, a method can be called in the same way as other commands.

hello

Arguments allow a method to be parameterized.
Methods can have named parameters.

define sum3: method (a b c) = {
add a b c
Expand Down Expand Up @@ -571,19 +571,19 @@ which produces the output,
Using oh, it is relatively simple to record the exit status for each stage
in a pipeline. The example below,

define exit-status: object
define exit-status: map

define pipe-fitting: method (label cmd: args) = {
exit-status::_set_ label: cmd @args
exit-status::set label: cmd @args
}

pipe-fitting "1st" echo 1 2 3 |
pipe-fitting "2nd" tr " " "\n" |
pipe-fitting "3rd" grep 2

echo "1st stage exit status =>" exit-status::1st
echo "2nd stage exit status =>" exit-status::2nd
echo "3rd stage exit status =>" exit-status::3rd
echo "1st stage exit status =>": exit-status::get "1st"
echo "2nd stage exit status =>": exit-status::get "2nd"
echo "3rd stage exit status =>": exit-status::get "3rd"

produces the output,

Expand Down
36 changes: 18 additions & 18 deletions lib/doctest/010-readme.oh
Expand Up @@ -27,36 +27,36 @@
## fexprs which, in turn, allow oh to be easily extended.

echo "Hello, World!"
cal 01 2030
cal 01 2030 | sed -re 's/[ ]+$//g' # Strip trailing spaces.
date >greeting
echo "Hello, World!" >>greeting
wc <greeting
cat greeting | wc # Useless use of cat.
tail -n1 greeting; cal 01 2030
tail -n1 greeting; cal 01 2030 | sed -re 's/[ ]+$//g' # Strip trailing spaces.
grep impossible *[a-z]ing &
wait
mkdir junk && cd junk
cd ..
rm -r greeting junk || echo "rm failed!"

#- Hello, World!
#- January 2030
#- Su Mo Tu We Th Fr Sa
#- 1 2 3 4 5
#- 6 7 8 9 10 11 12
#- 13 14 15 16 17 18 19
#- 20 21 22 23 24 25 26
#- 27 28 29 30 31
#-
#- January 2030
#- Su Mo Tu We Th Fr Sa
#- 1 2 3 4 5
#- 6 7 8 9 10 11 12
#- 13 14 15 16 17 18 19
#- 20 21 22 23 24 25 26
#- 27 28 29 30 31
#-
#- 2 8 43
#- 2 8 43
#- Hello, World!
#- January 2030
#- Su Mo Tu We Th Fr Sa
#- 1 2 3 4 5
#- 6 7 8 9 10 11 12
#- 13 14 15 16 17 18 19
#- 20 21 22 23 24 25 26
#- 27 28 29 30 31
#-
#- January 2030
#- Su Mo Tu We Th Fr Sa
#- 1 2 3 4 5
#- 6 7 8 9 10 11 12
#- 13 14 15 16 17 18 19
#- 20 21 22 23 24 25 26
#- 27 28 29 30 31
#-

2 changes: 1 addition & 1 deletion lib/doctest/020-generated-readme.oh
Expand Up @@ -6,6 +6,6 @@

## In fact, much of oh is written in oh. (Currently, 531
## of 6427 lines of code are written in oh with an
## additional 840 lines of go generated by 175 lines
## additional 840 lines of Go generated by 175 lines
## of oh).
##
2 changes: 1 addition & 1 deletion lib/doctest/120-simple-manual.oh
Expand Up @@ -16,7 +16,7 @@
mkdir /tmp/simple-commands
cd /tmp/simple-commands
touch 1 2 3
ls -l | awk "{ print $1 FS $9 }"
ls -l | awk "{ print $1 FS $9 }" | tr -d '.' # Remove dots
rm 1 2 3
cd _origin_
rmdir /tmp/simple-commands
Expand Down
2 changes: 1 addition & 1 deletion lib/doctest/150-globs-manual.oh
Expand Up @@ -26,7 +26,7 @@ ls *.go
## |:-------:|:---------------------------------------------------------------|
## | `*` | Matches any sequence of zero or more characters. |
## | `?` | Matches any single character. |
## | `[...]` | Matches any one of the characters enclosed. A pair separated by a minus will match a lexical range of characters.|
## | `[...]` | Matches any one of the characters enclosed. A pair separated by a minus will match a lexical range of characters. If the first enclosed character is a `^` the match is negated. |
##
## For example,
##
Expand Down
4 changes: 2 additions & 2 deletions lib/doctest/243-control-while-manual.oh
Expand Up @@ -6,7 +6,7 @@

## #### While
##
## The command,
## Oh has a fairly standard pre-test loop. The commands,
##
#{
define x = 0
Expand All @@ -16,7 +16,7 @@ while (lt x 10) {
}
#}
##
## produces the output,
## produce the output,
##
#+ 0
#+ 1
Expand Down
2 changes: 1 addition & 1 deletion lib/doctest/253-objects-method-manual.oh
Expand Up @@ -24,7 +24,7 @@ hello

#- Hello, World!

## Arguments allow a method to be parameterized.
## Methods can have named parameters.
##
#{
define sum3: method (a b c) = {
Expand Down
10 changes: 5 additions & 5 deletions lib/doctest/280-pipes-manual.oh
Expand Up @@ -10,19 +10,19 @@
## in a pipeline. The example below,
##
#{
define exit-status: object
define exit-status: map

define pipe-fitting: method (label cmd: args) = {
exit-status::_set_ label: cmd @args
exit-status::set label: cmd @args
}

pipe-fitting "1st" echo 1 2 3 |
pipe-fitting "2nd" tr " " "\n" |
pipe-fitting "3rd" grep 2

echo "1st stage exit status =>" exit-status::1st
echo "2nd stage exit status =>" exit-status::2nd
echo "3rd stage exit status =>" exit-status::3rd
echo "1st stage exit status =>": exit-status::get "1st"
echo "2nd stage exit status =>": exit-status::get "2nd"
echo "3rd stage exit status =>": exit-status::get "3rd"
#}
##
## produces the output,
Expand Down

0 comments on commit 194f044

Please sign in to comment.