Skip to content

Commit 676efdd

Browse files
authored
Merge pull request #41 from oasisprotocol/matevz/cli-examples
feat(docs): Add docs and example CLI usage
2 parents f7478d2 + d09b321 commit 676efdd

File tree

207 files changed

+4666
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+4666
-7
lines changed

.github/workflows/ci-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,8 @@ jobs:
4343
- name: Run tests
4444
run: |
4545
make test
46+
- name: Check examples
47+
run: |
48+
make clean-examples
49+
make examples
50+
git diff --exit-code examples

.markdownlint.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ line-length:
1010
# Line length checking is not strict by default.
1111
strict: true
1212
line_length: 80
13-
# Allow longer lines for code blocks.
14-
code_block_line_length: 100
13+
# Code blocks for examples are imported directly from the command output
14+
# and do not have sensible max line length.
15+
code_blocks: false
16+
17+
# Front matter title (shown in the menu and doccards) may differ from the one
18+
# on the actual page.
19+
single-title:
20+
front_matter_title: ""
21+
22+
# Docusaurus uses custom {#some-title} syntax to define fragments (anchors), see:
23+
# https://docusaurus.io/docs/next/markdown-features/toc#heading-ids
24+
# Unfortunately, it is not compatible with the markdown linter yet.
25+
link-fragments: false
1526

1627
# Do not always require language specifiers with fenced code blocks since they
1728
# are not part of the Markdown spec.

Makefile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
include common.mk
22

3+
# Each Oasis CLI example's input .in must have a corresponding output .out.
4+
EXAMPLES := $(patsubst %.in,%.out,$(wildcard examples/*/*.in))
5+
36
# Check if Go's linkers flags are set in common.mk and add them as extra flags.
47
ifneq ($(GOLDFLAGS),)
58
GO_EXTRA_FLAGS += -ldflags $(GOLDFLAGS)
@@ -9,10 +12,20 @@ endif
912
all: build
1013

1114
# Build.
12-
build:
15+
build: oasis
16+
oasis: $(shell find . -name "*.go" -type f) go.sum go.mod
1317
@$(PRINT) "$(MAGENTA)*** Building Go code...$(OFF)\n"
1418
@$(GO) build -v -o oasis $(GOFLAGS) $(GO_EXTRA_FLAGS)
1519

20+
examples: $(EXAMPLES)
21+
22+
examples/%.out: examples/%.in oasis scripts/gen_example.sh
23+
@rm -f $@
24+
@scripts/gen_example.sh $< $@
25+
26+
clean-examples:
27+
@rm -f examples/*/*.out
28+
1629
# Format code.
1730
fmt:
1831
@$(PRINT) "$(CYAN)*** Running Go formatters...$(OFF)\n"
@@ -64,6 +77,8 @@ clean:
6477
# List of targets that are not actual files.
6578
.PHONY: \
6679
all build \
80+
examples \
81+
clean-examples \
6782
fmt \
6883
$(lint-targets) lint \
6984
$(test-targets) test \

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ in your `$PATH`.
3131
*NOTE: The rest of the README assumes the `oasis` binary is somewhere in your
3232
`$PATH`.*
3333

34-
## Running
34+
## Quickstart
3535

3636
You can interact with the Oasis CLI by invoking it from the command line as
3737
follows:
@@ -57,7 +57,7 @@ subcommand as follows:
5757

5858
```bash
5959
oasis network set-default testnet
60-
oasis paratime set-default testnet emerald
60+
oasis paratime set-default testnet sapphire
6161
```
6262

6363
To be able to sign transactions you will need to first create or import an
@@ -82,7 +82,13 @@ To show the account's balance on the default network/ParaTime, run:
8282
oasis account show
8383
```
8484

85+
The `account` command also allows you to transfer tokens, deposit or withdraw to
86+
and from ParaTimes, delegate your assets to validators etc.
87+
88+
Check out the complete User's guide in [docs/README.md] and example invocations
89+
of the CLI in `examples` folder to learn more.
90+
8591
## Configuration
8692

87-
All configuration is stored in the `$XDG_CONFIG_HOME/oasis` directory (defaults
88-
to `$HOME/.config/oasis`).
93+
All configuration is stored in the `$XDG_CONFIG_HOME/oasis` directory (e.g.
94+
`$HOME/.config/oasis` on Linux).

docs/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Oasis CLI
3+
description: Powerful CLI for managing Oasis network, nodes, tokens and dapps
4+
---
5+
6+
# Oasis Command Line Interface
7+
8+
Oasis command-line interface (CLI) is a powerful all-in-one tool for
9+
interacting with the Oasis Network. You can download the latest release
10+
binaries from the [GitHub repository].
11+
12+
It boasts a number of handy features:
13+
14+
- Flexible setup:
15+
- supports Mainnet, Testnet, Localnet or any other Oasis network deployment
16+
- consensus layer configuration with arbitrary token
17+
- configuration of custom ParaTimes with arbitrary token
18+
- connecting to remote (via TCP/IP) or local (Unix socket) Oasis node
19+
instance
20+
- Powerful wallet features:
21+
- standard token operations (transfers, allowances, deposits, withdrawals and
22+
balance queries)
23+
- file-based wallet with password protection
24+
- full Ledger hardware wallet support
25+
- address book
26+
- generation, signing and submitting transactions in non-interactive
27+
(headless) mode
28+
- offline transaction generation for air-gapped machines
29+
- transaction encryption with X25519-Deoxys-II envelope
30+
- support for Ed25519, Ethereum-compatible Secp256k1 and Sr25519 signature
31+
schemes
32+
- raw, BIP-44, ADR-8 and Ledger's legacy derivation paths
33+
- Node operator features:
34+
- Oasis node inspection and healthchecks
35+
- network governance transactions
36+
- staking reward schedule transactions
37+
- Developer features:
38+
- built-in testing accounts compatible with the Oasis test runner, the Oasis
39+
CI and the official sapphire-dev and emerald-dev Docker images
40+
- Oasis Wasm smart contract code deployment, instantiation, management and
41+
calls
42+
- debugging tools for deployed Wasm contracts
43+
- inspection of blocks, transactions, results and events
44+
45+
[GitHub repository]: https://github.com/oasisprotocol/cli/releases

0 commit comments

Comments
 (0)