Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add std/cli, move std/getopt there #1057

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,17 @@ module.exports = {
]
},

{ title: "Unix Command Line Interface",
path: "/reference/std/cli/",
children: [
"cli/",
"cli/getopt",
"cli/shell",
"cli/print-exit",
"cli/multicall",
]
},

{ title: "Databases and Key-Value Stores",
path: "/reference/std/db/",
children: [
Expand Down
8 changes: 4 additions & 4 deletions doc/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ $ cat hello/lib.ss
$ cat hello/main.ss
;;; -*- Gerbil -*-
(import :std/sugar
:std/getopt
:std/cli/getopt
./lib)
(export main)

Expand All @@ -192,7 +192,7 @@ $ cat hello/main.ss
(call-with-getopt hello-main args
program: "hello"
help: "A one line description of your program"
;; commands/options/flags for your program; see :std/getopt
;; commands/options/flags for your program; see :std/cli/getopt
;; ...
))

Expand Down Expand Up @@ -268,12 +268,12 @@ $ cat hello/lib.ss
(displayln greeting ", " who))
```

And in the generated `hello/main.ss` file, we add a [getopt](/reference/std/getopt.md) option for a single argument and implement `hello-main/options` to greet:
And in the generated `hello/main.ss` file, we add a [getopt](/reference/std/cli/getopt.md) option for a single argument and implement `hello-main/options` to greet:
```scheme
$ cat hello/main.ss
;;; -*- Gerbil -*-
(import :std/sugar
:std/getopt
:std/cli/getopt
./lib)
(export main)

Expand Down
4 changes: 2 additions & 2 deletions doc/reference/dev/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ $ cat scraper/main.ss
;;; -*- Gerbil -*-
(import :std/error
:std/sugar
:std/getopt
:std/cli/getopt
:gerbil/gambit
./lib)
(export main)
Expand Down Expand Up @@ -494,7 +494,7 @@ $ cat scraper/main.ss
;;; -*- Gerbil -*-
(import :std/error
:std/sugar
:std/getopt
:std/cli/getopt
:gerbil/gambit
./lib)
(export main)
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/gerbil/expander/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ Please document me!

Please document me!

### core-module-export->import
### core-module-export->import
```
(core-module-export->import ...)
```
Expand Down
4 changes: 2 additions & 2 deletions doc/reference/gerbil/runtime/MOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ Accesses *obj*'s field with absolute offset *off*; there is no type check.

Mutates *obj*'s field with absolute offset *off* to *val*; there is no type check.

## struct->list
## struct->list
``` scheme
(struct->list obj) -> list

Expand Down Expand Up @@ -482,7 +482,7 @@ Returns the value associated with slot *slot* in *obj*, without any checks.

Sets the value associated with slot *slot* in *obj* to *val*, without any checks.

## class->list
## class->list
``` scheme
(class->list obj)

Expand Down
16 changes: 8 additions & 8 deletions doc/reference/gerbil/runtime/hash-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ Merges *more* hash tables into *hash*. Entries in hash tables on the left take p
((a . 1) (z . 6) (b . 2) (c . 3))
```

## hash->list
## hash->list
``` scheme
(hash->list hash) -> list

Expand All @@ -249,7 +249,7 @@ Merges *more* hash tables into *hash*. Entries in hash tables on the left take p

Returns the bindings of *hash* as an alist.

## list->hash-table
## list->hash-table
``` scheme
(list->hash-table lst . options) -> hash table

Expand All @@ -258,7 +258,7 @@ Returns the bindings of *hash* as an alist.

Creates a hash table from an alist *lst*.

## list->hash-table-eq
## list->hash-table-eq
``` scheme
(list->hash-table-eq lst . options) -> hash table

Expand All @@ -267,7 +267,7 @@ Creates a hash table from an alist *lst*.

Same as `list->hash-table`, but using `eq?` as the test function for the table.

## list->hash-table-eqv
## list->hash-table-eqv
``` scheme
(list->hash-table-eqv lst . options) -> hash table

Expand All @@ -276,7 +276,7 @@ Same as `list->hash-table`, but using `eq?` as the test function for the table.

Same as `list->hash-table`, but using `eqv?` as the test function for the table.

## hash->plist
## hash->plist
``` scheme
(hash->plist hash) -> list

Expand All @@ -285,7 +285,7 @@ Same as `list->hash-table`, but using `eqv?` as the test function for the table.

Returns the bindings of *hash* as a plist.

## plist->hash-table
## plist->hash-table
``` scheme
(plist->hash-table lst) -> hash table

Expand All @@ -294,7 +294,7 @@ Returns the bindings of *hash* as a plist.

Creates a hash table from a plist *lst*.

## plist->hash-table-eq
## plist->hash-table-eq
``` scheme
(plist->hash-table-eq lst) -> hash table

Expand All @@ -303,7 +303,7 @@ Creates a hash table from a plist *lst*.

Same as `plist->hash-table`, but using `eq?` as the test function for the table.

## plist->hash-table-eqv
## plist->hash-table-eqv
``` scheme
(plist->hash-table-eqv lst) -> hash table

Expand Down
4 changes: 2 additions & 2 deletions doc/reference/gerbil/runtime/misc-procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ it is considered a single value.
Returns the *n*th value in the object *obj*. If the object is not multiple `values`,
it returns the object itself.

### values->list
### values->list
``` scheme
(values->list obj) -> list

Expand All @@ -30,7 +30,7 @@ it returns the object itself.
Converts multiple `values` to a list. If the object *obj* is not multiple `values`,
it returns a list containing the object.

### subvector->list
### subvector->list
``` scheme
(subvector->list obj [start = 0]) -> list

Expand Down
6 changes: 3 additions & 3 deletions doc/reference/gerbil/runtime/strings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Strings

## bytes->string
## bytes->string
```
(bytes->string bstr [encoding = 'UTF-8]) -> string

Expand All @@ -12,7 +12,7 @@ Decodes a byte vector *bstr* to a string.
Note: if you are decoding UTF-8, then you should consider using `string->utf8`
from `:std/text/utf8` which is considerably faster.

## string->bytes
## string->bytes
``` scheme
(string->bytes str [encoding = 'UTF-8]) -> u8vector

Expand All @@ -25,7 +25,7 @@ Note: if you are encoding UTF-8, then you should consider using `utf8->string`
from `:std/text/utf8` which is considerably faster.


## substring->bytes
## substring->bytes
``` scheme
(substring->bytes str start end [encoding = 'UTF-8]) -> u8vector

Expand Down
4 changes: 2 additions & 2 deletions doc/reference/gerbil/runtime/symbols.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Returns true if the object *obj* is an interned symbol.

Returns true if the object *obj* is an interned keyword.

## symbol->keyword
## symbol->keyword
``` scheme
(symbol->keyword sym) -> keyword

Expand All @@ -41,7 +41,7 @@ Returns true if the object *obj* is an interned keyword.

Converts a symbol *sym* to a keyword.

## keyword->symbol
## keyword->symbol
``` scheme
(keyword->symbol kw) -> symbol

Expand Down
7 changes: 7 additions & 0 deletions doc/reference/std/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Command Line Interface

The following libraries are provided to support the Command Line Interface (CLI):
- [:std/cli/getopt](getopt.md)
- [:std/cli/shell](shell.md)
- [:std/cli/print-exit](print-exit.md)
- [:std/cli/multicall](multicall.md)
Loading