{"id":26468751,"url":"https://github.com/tektronix/numconverter","last_synced_at":"2025-03-19T16:57:38.851Z","repository":{"id":35421096,"uuid":"207409873","full_name":"tektronix/numconverter","owner":"tektronix","description":"Simple base conversion project in Rust.","archived":false,"fork":false,"pushed_at":"2023-01-25T21:08:11.000Z","size":110,"stargazers_count":3,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-28T09:59:49.986Z","etag":null,"topics":["arithmetic","conversion","hacktoberfest","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tektronix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2019-09-09T21:40:26.000Z","updated_at":"2022-01-29T02:18:20.000Z","dependencies_parsed_at":"2023-02-14T11:31:12.217Z","dependency_job_id":null,"html_url":"https://github.com/tektronix/numconverter","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tektronix%2Fnumconverter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tektronix%2Fnumconverter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tektronix%2Fnumconverter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tektronix%2Fnumconverter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tektronix","download_url":"https://codeload.github.com/tektronix/numconverter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244470242,"owners_count":20457906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arithmetic","conversion","hacktoberfest","rust"],"created_at":"2025-03-19T16:57:38.149Z","updated_at":"2025-03-19T16:57:38.838Z","avatar_url":"https://github.com/tektronix.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![TekMonogram](https://tektronix.github.io/media/tekmonogram.png)](https://github.com/tektronix)\n\n# Number Converter\n[![Tektronix](https://tektronix.github.io/media/TEK-opensource_badge.svg)](https://github.com/tektronix)\n[![CodeFactor](https://www.codefactor.io/repository/github/tektronix/numconverter/badge)](https://www.codefactor.io/repository/github/tektronix/numconverter)\n[![Build Status](https://travis-ci.com/tektronix/numconverter.svg?branch=main)](https://travis-ci.com/tektronix/numconverter)\n![GitHub repo size](https://img.shields.io/github/repo-size/tektronix/numconverter)\n![GitHub contributors](https://img.shields.io/github/contributors/tektronix/numconverter)\n![GitHub stars](https://img.shields.io/github/stars/tektronix/numconverter?style=social)\n![GitHub forks](https://img.shields.io/github/forks/tektronix/numconverter?style=social)\n\nA simple base conversion project in Rust.\n\n## Installation\n\n### Crates.io\nNumconverter is on Crates.io! Just install via\n```\ncargo install numconverter\n```\n\n### From source\nClone the repo and run `cargo build --release`.  The executable `numconverter` will be in the `target/release` directory.  Run from there, or move/symlink to a location in your `PATH` (`~/bin/` for example).\n\nI alias the name to `ncon` and derivatives, based on what base I'm inputing:\n```\nalias ncon=\"numconverter\"\nalias bcon=\"numconverter --from-base 2\"\nalias ocon=\"numconverter --from-base 8\"\nalias hcon=\"numconverter --from-base 16\"\n```\n\n## Dependencies\nBuilt using Rust. ([Rust installation instructions](https://www.rust-lang.org/tools/install)).\n- Uses the `structopt` crate to handle command line input.\n- Uses the `clipboard` crate to handle read and write to clipboard. [For Linux: `x11_clipboard` \u0026 `nix` crates]\n\n#### Linux\nDependencies for clipboard functionality include:\n- libxcb-shape0-dev\n- libxcb-xfixes0-dev\n\nInstall with\n```\nsudo apt-get install libxcb-shape0-dev libxcb-xfixes0-dev\n```\n\n\n## Usage\n\nSome basic usage examples are provided below:\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eShow Examples\u003c/b\u003e\u003c/summary\u003e\n\nBasic decimal conversion\n```\n$ numconverter 255\nBase 02: 1111_1111\nBase 08: 377\nBase 10: 255\nBase 16: FF\n```\n\nSpecify binary input\n```\n$ numconverter b 1001\nBase 02: 1001\nBase 08: 11\nBase 10: 9\nBase 16: 9\n```\n\nSpecify hexidecimal input\n```\n$ numconverter h ab12\nBase 02: 1010_1011_0001_0010\nBase 08: 12_5422\nBase 10: 4_3794\nBase 16: AB12\n```\n\nSpecify output base - binary (base 2) to hexidecimal (base 16)\n```\n$ numconverter b 1010 16\nBase 16: A\n```\n\nSpecify output bases (non standard)\n```\n$ numconverter 1234567890 3 5 12 22 32\nBase 03: 1001_2001_0011_1220_2200\nBase 05: 10_0120_2213_3030\nBase 12: 2_A555_5016\nBase 22: AJC_3E26\nBase 32: 14P_C0MI\n```\n\n\u003c/details\u003e\n\nEnter `numconverter --help` for available options.\n\n```\nnumconverter [base_char] [from_num] [to_base]... [FLAGS]... [OPTIONS]...\n\nARGS:\n    base_char   (b, o, d, h - binary, octal, decimal, hex) Character\n                representing the 'from' base.  If both the base_char and\n                the -f/--from-base are provided, base_char will be used.\n    from_num    The input number to convert.  Default base 10.\n    to_base     A list of base 10 numbers to convert from_num to.  Base\n                must be between 2 and 32 inclusive.\n\nFLAGS:\n    -b, --bare              Disable Pretty Print\n    -c, --copy              Copy the resulting ouput to clipboard\n        --from-clipboard    Get the input number from clipboard\n    -h, --help              Prints help information\n        --no-sep            Do not pad the output\n    -s, --silent            Do not print output, for use with the clipboard on.\n    -V, --version           Prints version information\n    -v, --verbosity         Verbosity (more v's, more verbose)\n\n\nOPTIONS:\n    -f, --from-base \u003cfrom-base\u003e      Base of the input number [default: 10]\n    -p, --pad \u003cpad\u003e                  Pad the output with leading 0s [default: 0]\n        --sep-char \u003csep-char\u003e        Specify spacer char [default: _]\n    -l, --sep-length \u003csep-length\u003e    Put a spacer every N characters [default: 4]\n```\n\n\n## Contributing\nBefore submitting a PR, please make sure you have:\n* Run `cargo test`.\n  * This runs all the defined tests.  Be sure to add test coverage for your PR when possible! 😁\n* Checked there are no warnings when compiling.\n  * `cargo clean \u0026\u0026 cargo build` ensures everything is compiled fresh and will give you maximum visibility on warnings.\n  * TravisCI will be run with `cargo build --features=fail-on-warnings`, so give that a check to avoid waiting on the long CI build.\n* Run `cargo fmt` and commit the result.\n  * Some of the results when automatically formatting are not ideal (in my opinion), but a common format is better than inconsistent format (also in my opinion).  The default format is a safe decision to be consistent with the rest of the Rust community.  If there is a formatting decision you find untenable, open an Issue and start a discussion (please be civil, see the [Code of Conduct](CODE_OF_CONDUCT.md) 😉).\n\n### License\n\nLicensed under either of\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n#### Contributor License Agreement\nContributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project.\n\n### Maintainers\n[Zach Nielsen](https://github.com/ZNielsen) - @ZNielsen\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftektronix%2Fnumconverter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftektronix%2Fnumconverter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftektronix%2Fnumconverter/lists"}