Skip to content

Commit

Permalink
Merge pull request #28 from ThalaLabs/0xbe1/md-docs
Browse files Browse the repository at this point in the history
feat: make docs markdown
  • Loading branch information
0xbe1 authored Dec 8, 2024
2 parents bcc180c + 3c04bf9 commit c9a6d42
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 30 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ A **highly visible** CLI tool for managing multisig on Aptos.

## Docs

See [DOCS.txt](./DOCS.txt).
See [docs.md](./docs.md).
89 changes: 62 additions & 27 deletions DOCS.txt → docs.md
Original file line number Diff line number Diff line change
@@ -1,131 +1,166 @@
Usage: dontrust pending [options]
## dontrust pending [options]

Get pending transaction(s) for a multisig

```
Options:
-m, --multisig <address> multisig contract address
-s, --sequence_number <number> fetch transaction with specific sequence number
-h, --help display help for command
```

--
Usage: dontrust executed [options]
## dontrust executed [options]

Get successfully executed transactions for a multisig

```
Options:
-m, --multisig <address> multisig contract address
-l, --limit <number> number of executed transactions to fetch (default: 10)
-h, --help display help for command
```

--
Usage: dontrust decode [options]
## dontrust decode [options]

Decode multisig transaction bytes

```
Options:
-b, --bytes <bytes> transaction bytes to decode (hex string starting with 0x)
-h, --help display help for command
```

--
Usage: dontrust encode [options]
## dontrust encode [options]

Encode entry function payload

```
Options:
-f, --txn-payload-file <txn-payload-file> transaction payload file to encode
-h, --help display help for command
```

--
Usage: dontrust addresses [options] [command]
## dontrust addresses [options] [command]

Manage the local address book

```
Options:
-h, --help display help for command

Commands:
add [options] Add a new alias and address to the local address book
list List all saved aliases and addresses
remove [options] Remove an alias from the local address book
help [command] display help for command
```

--
Usage: dontrust addresses add [options]
## dontrust addresses add [options]

Add a new alias and address to the local address book

```
Options:
--alias <alias> Alias for the address
--address <address> Hexadecimal address (e.g., 0xabc)
-h, --help display help for command
```

--
Usage: dontrust addresses list [options]
## dontrust addresses list [options]

List all saved aliases and addresses

```
Options:
-h, --help display help for command
```

--
Usage: dontrust addresses remove [options]
## dontrust addresses remove [options]

Remove an alias from the local address book

```
Options:
--alias <alias> Alias to remove
-h, --help display help for command
```

--
Usage: dontrust summary [options]
## dontrust summary [options]

Get summary information for a multisig

```
Options:
-m, --multisig <address> multisig contract address
-h, --help display help for command
```

--
Usage: dontrust simulate [options]
## dontrust simulate [options]

Simulate transaction for a multisig (ignoring signer thresholds)

```
Options:
-m, --multisig <address> multisig contract address
-s, --sequence_number <number> fetch transaction with specific sequence number
-h, --help display help for command
```

--
Usage: dontrust vote [options] [command]
## dontrust vote [options] [command]

Vote on pending transaction

```
Options:
-h, --help display help for command

Commands:
approve [options] Approve pending transaction for a multisig
reject [options] Reject pending transaction for a multisig
help [command] display help for command
```

--
Usage: dontrust vote approve [options]
## dontrust vote approve [options]

Approve pending transaction for a multisig

```
Options:
-m, --multisig <address> multisig contract address
-s, --sequence_number <number> fetch transaction with specific sequence number
-p, --profile <address> profile name of voter
-h, --help display help for command
```

--
Usage: dontrust vote reject [options]
## dontrust vote reject [options]

Reject pending transaction for a multisig

```
Options:
-m, --multisig <address> multisig contract address
-s, --sequence_number <number> fetch transaction with specific sequence number
-p, --profile <address> profile name of voter
-h, --help display help for command
```

## dontrust propose [options]

Propose a multisig transaction

```
Options:
-m, --multisig-address <multisig-address> Multisig address
-p, --profile <profile> Profile to use for the transaction
-f, --txn-payload-file <file> Path to the transaction payload file
-h, --help display help for command
```

## dontrust execute [options]

Execute a multisig transaction

```
Options:
-m, --multisig-address <multisig-address> Multisig address
-p, --profile <profile> Profile to use for the transaction
-h, --help display help for command
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "tsc",
"start": "node dist/index.js",
"format": "prettier --write \"**/*.{js,ts,json,md}\" --ignore-path .gitignore",
"docgen": "node dist/index.js docgen -o DOCS.txt"
"docgen": "node dist/index.js docgen -o docs.md"
},
"keywords": [],
"description": "A highly visible CLI tool for managing multisig on Aptos.",
Expand Down
10 changes: 9 additions & 1 deletion src/commands/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ export function registerDocgenCommand(program: Command) {
.slice(1) // Remove root program
.filter((cmd) => cmd.name() !== 'docgen'); // Remove docgen command

const docs = allCommands.map((command) => command.helpInformation()).join('\n--\n');
const docs = allCommands
.map((command) => {
const helpText = command.helpInformation();
const lines = helpText.split('\n').filter((line) => line.trim() !== '');
const [fullCommand, description, ...options] = lines;
const heading = fullCommand.replace('Usage: ', '## ');
return `${heading}\n\n${description}\n\n\`\`\`\n${options.join('\n')}\n\`\`\``;
})
.join('\n');

if (options.output) {
const outputPath = join(process.cwd(), options.output);
Expand Down

0 comments on commit c9a6d42

Please sign in to comment.