hex

package
v0.0.0-...-35fa527 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hex = &cli.Command{
	Name:  "hex",
	Usage: "convert number to hex",
	UsageText: `hex [command] -[flag] [args...]
hex 0b110
hex 06
hex 0x1e
hex -b 1988
hex -o 1988
hex -d 1988
`,
	ArgsUsage: "encode [ids...]",
	Action: func(c *cli.Context) error {
		if c.NArg() == 0 {
			return errors.New("none number is present")
		}

		for _, v := range c.Args().Slice() {
			number, err := parseInt(v)
			if err != nil {
				return err
			}

			if hexArgs.binary {
				printBinary(number)
			} else if hexArgs.octal {
				printOctal(number)
			} else if hexArgs.decimal {
				printDecimal(number)
			}
		}

		return nil
	},
	Flags: hexFlags,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL