Skip to content

Commit

Permalink
Fix alignment in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jarun committed Oct 2, 2017
1 parent d7d3358 commit 4868954
Showing 1 changed file with 62 additions and 60 deletions.
122 changes: 62 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,45 +86,47 @@ To uninstall, run:

#### cmdline options

usage: bcal [-c N] [-f FORMAT] [-s bytes] [-d] [-h]
[expression] [N unit]

Perform storage conversions and calculations.

positional arguments:
expression evaluate storage arithmetic expression
+, -, *, / with decimal inputs supported
unit can be multiplied or divided by +ve integers
units can be added or subtracted from each other
Examples:
bcal "(5kb+2mb)/3"
bcal "5 tb / 12"
bcal "2.5mb*3"
N [unit] capacity in B/KiB/MiB/GiB/TiB/kB/MB/GB/TB
see https://wiki.ubuntu.com/UnitsPolicy
default unit is B (byte), case is ignored
N can be decimal or '0x' prefixed hex value

optional arguments:
-c N show +ve integer N in binary, decimal and hex
-f FORMAT convert CHS to LBA or LBA to CHS
formats are hyphen-separated
LBA format:
starts with 'l':
lLBA-MAX_HEAD-MAX_SECTOR
CHS format:
starts with 'c':
cC-H-S-MAX_HEAD-MAX_SECTOR
omitted values are considered 0
FORMAT 'c-50--0x12-' denotes:
C = 0, H = 50, S = 0, MH = 0x12, MS = 0
FORMAT 'l50-0x12' denotes:
LBA = 50, MH = 0x12, MS = 0
default MAX_HEAD: 16, default MAX_SECTOR: 63
-s bytes sector size [default 512]
-m show minimal output (e.g. decimal bytes)
-d enable debug information and logs
-h show this help and exit
```
usage: bcal [-c N] [-f FORMAT] [-s bytes] [-d] [-h]
[expression] [N unit]
Perform storage conversions and calculations.
positional arguments:
expression evaluate storage arithmetic expression
+, -, *, / with decimal inputs supported
unit can be multiplied or divided by +ve integers
units can be added or subtracted from each other
Examples:
bcal "(5kb+2mb)/3"
bcal "5 tb / 12"
bcal "2.5mb*3"
N [unit] capacity in B/KiB/MiB/GiB/TiB/kB/MB/GB/TB
see https://wiki.ubuntu.com/UnitsPolicy
default unit is B (byte), case is ignored
N can be decimal or '0x' prefixed hex value
optional arguments:
-c N show +ve integer N in binary, decimal and hex
-f FORMAT convert CHS to LBA or LBA to CHS
formats are hyphen-separated
LBA format:
starts with 'l':
lLBA-MAX_HEAD-MAX_SECTOR
CHS format:
starts with 'c':
cC-H-S-MAX_HEAD-MAX_SECTOR
omitted values are considered 0
FORMAT 'c-50--0x12-' denotes:
C = 0, H = 50, S = 0, MH = 0x12, MS = 0
FORMAT 'l50-0x12' denotes:
LBA = 50, MH = 0x12, MS = 0
default MAX_HEAD: 16, default MAX_SECTOR: 63
-s bytes sector size [default 512]
-m show minimal output (e.g. decimal bytes)
-d enable debug information and logs
-h show this help and exit
```

#### Operational notes

Expand All @@ -148,40 +150,40 @@ To uninstall, run:

1. Evaluate arithmetic expression of storage units.

$ bcal "(5kb+2mb)/3"
$ bcal "5 tb / 12"
$ bcal "2.5mb*3"
$ bcal "(5kb+2mb)/3"
$ bcal "5 tb / 12"
$ bcal "2.5mb*3"
2. Convert storage capacity to other units and get address, LBA.

$ bcal 20140115 b
$ bcal 0x1335053 B
$ bcal 0xaabbcc kb
$ bcal 0xdef Gib
$ bcal 20140115 b
$ bcal 0x1335053 B
$ bcal 0xaabbcc kb
$ bcal 0xdef Gib
Note that the units are case-insensitive.
3. Convert storage capacity, set sector size to 4096 to calculate LBA.

$ bcal 0xaabbcc kb -s 4096
$ bcal 0xaabbcc kb -s 4096
4. Convert LBA to CHS.

$ bcal -f l500
$ bcal -f l0x600-18-0x7e
$ bcal -f l0x300-0x12-0x7e
$ bcal -f l500
$ bcal -f l0x600-18-0x7e
$ bcal -f l0x300-0x12-0x7e
5. Convert CHS to LBA.

$ bcal -f c10-10-10
$ bcal -f c0x10-0x10-0x10
$ bcal -f c0x10-10-2-0x12
$ bcal -f c-10-2-0x12
$ bcal -f c0x10-10--0x12
$ bcal -f c10-10-10
$ bcal -f c0x10-0x10-0x10
$ bcal -f c0x10-10-2-0x12
$ bcal -f c-10-2-0x12
$ bcal -f c0x10-10--0x12
6. Show binary, decimal and hex representations of a number.

$ bcal -c 20140115
$ bcal -c 0b1001100110101000001010011
$ bcal -c 0x1335053
$ bcal -c 20140115
$ bcal -c 0b1001100110101000001010011
$ bcal -c 0x1335053
7. Help and additional information.

$ man bcal
$ bcal -h
$ man bcal
$ bcal -h

### Testing

Expand Down

0 comments on commit 4868954

Please sign in to comment.