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

docs: add cast --to-base #617

Merged
merged 2 commits into from
Sep 10, 2022
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
3 changes: 1 addition & 2 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,9 @@
- [cast --from-utf8](./reference/cast/cast--from-utf8.md)
- [cast --parse-bytes32-string](./reference/cast/cast--parse-bytes32-string.md)
- [cast --to-ascii](./reference/cast/cast--to-ascii.md)
- [cast --to-base](./reference/cast/cast--to-base.md)
- [cast --to-bytes32](./reference/cast/cast--to-bytes32.md)
- [cast --to-dec](./reference/cast/cast--to-dec.md)
- [cast --to-fix](./reference/cast/cast--to-fix.md)
- [cast --to-hex](./reference/cast/cast--to-hex.md)
- [cast --to-hexdata](./reference/cast/cast--to-hexdata.md)
- [cast --to-int256](./reference/cast/cast--to-int256.md)
- [cast --to-rlp](./reference/cast/cast--to-rlp.md)
Expand Down
44 changes: 44 additions & 0 deletions src/reference/cast/cast--to-base.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## cast --to-base

### NAME

cast---to-base - Convert a number of one base to another.

### SYNOPSIS

``cast --to-base`` [*options*] *value* *base*

### DESCRIPTION

Convert a number of one base to another.

### OPTIONS

#### Base Options

`--base-in` *base*
    The base of the input number. Available options:

    10, d, dec, decimal

    16, h, hex, hexadecimal

{{#include common-options.md}}

### EXAMPLES

1. Convert the decimal number 64 to hexadecimal
```sh
cast --to-base 64 hex
```

2. Convert the hexadecimal number 100 to binary
```sh
cast --to-base 0x100 2
```

> Note: The --base-in parameter is not enforced but will be needed if the input is ambiguous.

### SEE ALSO

[cast](./cast.md)
21 changes: 0 additions & 21 deletions src/reference/cast/cast--to-dec.md

This file was deleted.

28 changes: 0 additions & 28 deletions src/reference/cast/cast--to-hex.md

This file was deleted.

6 changes: 3 additions & 3 deletions src/reference/cast/cast-shl.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Perform a left shifting operation.

### OPTIONS

{{#include ../common/shift-options.md}}
{{#include ../common/base-options.md}}

{{#include common-options.md}}

Expand All @@ -26,7 +26,7 @@ Perform a left shifting operation.
```

> Note: The --base-in parameter is not enforced but will be needed if the input is ambiguous.

### SEE ALSO

[cast](./cast.md), [cast shr](./cast-shr.md)
[cast](./cast.md), [cast shr](./cast-shr.md)
3 changes: 1 addition & 2 deletions src/reference/cast/cast-shr.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Perform a left shifting operation.

### OPTIONS

{{#include ../common/shift-options.md}}
{{#include ../common/base-options.md}}

{{#include common-options.md}}

Expand All @@ -30,4 +30,3 @@ Perform a left shifting operation.
### SEE ALSO

[cast](./cast.md), [cast shl](./cast-shl.md)

Loading