Skip to content

Commit

Permalink
Add documentation for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
soveran committed Sep 6, 2021
1 parent ba208c0 commit beae8c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,8 @@ If set, clac will search for `$HOME/.config/clac/words`.

### How to define words

Words are defined as aliases, with one alias on each line. Empty
lines and lines starting with `#` are ignored. Here are some examples:
Words are defined as aliases, with one alias on each line.
Empty lines are ignored. Here are some examples:

```shell
pi 3.14159265358979323846
Expand Down Expand Up @@ -251,6 +251,22 @@ $ clac "42 dup * pi *"
5541.76944093239
```

### Comments

Any lines that begin with `#` are considered comments and
are ignored. There are no inline comments, and any `#`
characters that are not the first character of a line are
interpreted literally. To define `#` as a word, wrap it in
double quotes in the definition:

```shell
# This is a comment.
"#" count
```

The first line is ignored, and the second line assigns `#`
to the operation `count`.

### How to list defined words

If you type `words` and hit enter, clac will list the defined words.
Expand Down
20 changes: 20 additions & 0 deletions clac.1
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,26 @@ User defined words can be used as if they were built-in commands:
.Dl $ clac Qq "42 dup * pi *"
.Dl Sy 5541.76944093239
.
.Ss Comments
.
Any lines that begin with
.Sy #
are considered comments and are ignored. There are no inline comments,
and any
.Sy #
characters that are not the first character of a line are interpreted
literally. To define
.Sy #
as a word, wrap it in double quotes in the definition:
.Pp
.Dl # This is a comment.
.Dl \(dq#\(dq count
.Pp
The first line is ignored, and the second line assigns
.Sy #
to the operation
.Sy count.
.
.Ss How to list defined words
.
If you type `words` and hit enter, clac will list the defined words.
Expand Down

0 comments on commit beae8c4

Please sign in to comment.