Skip to content

Commit

Permalink
hex-vis: handle bytes
Browse files Browse the repository at this point in the history
Signed-off-by: Ciro S. Costa <[email protected]>
  • Loading branch information
cirocosta committed Apr 20, 2021
1 parent f406fd6 commit 4e97c5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/hex-vis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

var opts = struct {
Byte byte `long:"byte"`
Uint16 uint16 `long:"uint16"`
Uint32 uint32 `long:"uint32"`
String string `long:"string"`
Expand All @@ -27,6 +28,8 @@ func main() {
var b []byte

switch {
case opts.Byte != 0:
b = []byte{opts.Byte}
case opts.Uint16 != 0:
b = make([]byte, 2)
binary.LittleEndian.PutUint16(b, opts.Uint16)
Expand Down

0 comments on commit 4e97c5e

Please sign in to comment.