Merge pull request 'v0.3.2' (#18) from devel into master
cargo devel CI / cargo CI (push) Has been cancelled Details

Reviewed-on: #18
This commit is contained in:
Christoph J. Scherr 2024-05-16 17:52:34 +02:00
commit 63b56362c7
5 changed files with 28 additions and 46 deletions

View File

@ -16,8 +16,7 @@ categories = ["command-line-utilities", "encoding"]
[dependencies] [dependencies]
anyhow = "1.0.83" anyhow = "1.0.83"
clap = { version = "4.5.4", features = ["derive"] } clap = { version = "4.5.4", features = ["derive"] }
clap-num = "1.1.1"
fast32 = "1.0.2" fast32 = "1.0.2"
libpt = { version = "0.5.1", features = ["bintols"]} libpt = { version = "0.5.1", features = ["bintols"], default-features = false }
num = "0.4.3" num = "0.4.3"

View File

@ -1,5 +1,18 @@
# numf # numf
![Project badge](https://img.shields.io/badge/language-Rust-blue.svg)
![Crates.io License](https://img.shields.io/crates/l/numf)
![Gitea Release](https://img.shields.io/gitea/v/release/PlexSheep/numf?gitea_url=https%3A%2F%2Fgit.cscherr.de)
![Gitea language count](https://img.shields.io/gitea/languages/count/PlexSheep/numf?gitea_url=https%3A%2F%2Fgit.cscherr.de)
[![cargo checks and tests](https://github.com/PlexSheep/numf/actions/workflows/cargo.yaml/badge.svg)](https://github.com/PlexSheep/numf/actions/workflows/cargo.yaml)
* [Original Repository](https://git.cscherr.de/PlexSheep/numf)
* [GitHub Mirror](https://github.com/PlexSheep/numf)
* [Codeberg Mirror](https://codeberg.org/PlexSheep/numf)
* [crates.io](https://crates.io/crates/numf)
* [docs.rs](https://docs.rs/numf/latest/numf/)
`numf` is a number formatter. It formats the numbers provided to it. `numf` is a number formatter. It formats the numbers provided to it.
Current formats are: Current formats are:
@ -11,8 +24,9 @@ Current formats are:
- Base32 - Base32
- Base64 - Base64
`numf` also has the option of prepending a prefix for each format, such as `numf` also has the onumfion of prepending a prefix for each format, such as
`0x` for hexadecimal. `0x` for hexadecimal. Numbers may also be provided from the stdin. See `--help`
flag for more information.
## Example ## Example

View File

@ -1,11 +0,0 @@
#!/bin/bash
set -e
cargo check --all-features
echo ">>>>>>>> PUBLISHING RELEASE FOR REPO"
bash scripts/release.sh
echo ">>>>>>>> PUBLISHING TO CRATES.IO NEXT"
sleep 2
cargo publish
echo ">>>>>>>> PUBLISHING TO CSCHERR.DE NEXT"
sleep 2
cargo publish --registry cscherr

View File

@ -1,24 +0,0 @@
#!/bin/bash
TOKEN=$(cat ~/.git-credentials | grep 'git.cscherr.de' | grep -P '(?:)[^:]*(?=@)' -o)
NEW_VERSION=$(cat Cargo.toml | rg '^\s*version\s*=\s*"([^"]*)"\s*$' -or '$1')
GIT_COMMIT_SHA=$(git rev-parse HEAD)
REPO=${PWD##*/} # name of cwd
BODY="
$(git log $(git describe --tags --abbrev=0)..HEAD --pretty="- %s" --oneline --decorate)
"
USER=PlexSheep
git tag "v$NEW_VERSION" || echo "could not tag"
curl -X 'POST' \
'https://git.cscherr.de/api/v1/repos/PlexSheep/'$REPO'/releases' \
-H 'accept: application/json' \
-H "Authorization: token $TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"body": "'"$BODY"'",
"draft": false,
"name": "v'$NEW_VERSION'",
"prerelease": true,
"tag_name": "v'$NEW_VERSION'",
"target_commitish": "'$GIT_COMMIT_SHA'"
}' | python -m json.tool
git push || echo "could not push"

View File

@ -69,20 +69,24 @@ pub struct FormatOptions {
/// format to base32 /// format to base32
base32: bool, base32: bool,
#[clap(value_parser=numf_parser::<NumberType>, required=false)] #[clap(value_parser=numf_parser::<NumberType>, required=false)]
/// at least one number that should be formatted /// numbers that should be formatted
/// ///
/// Any of the [Formats](Format::format) are supported, but the prefixes are needed for formats /// Any of the [Formats](Format::format) are supported, but the prefixes are needed for formats
/// other than decimal. /// other than decimal.
/// ///
/// Formats: /// Formats:
/// ///
/// - '0x' - Hexadecimal /// * '0x' - Hexadecimal
/// - '0b' - Binary
/// - '0o' - Octal
/// - '0s' - Base64
/// - '032s' - Base32
/// ///
/// The numbers may be left empty at first, if numbers are provided with the stdin. /// * '0b' - Binary
///
/// * '0o' - Octal
///
/// * '0s' - Base64
///
/// * '032s' - Base32
///
/// The numbers may be left empty at first, if numbers are provided from the stdin.
numbers: Vec<NumberType>, numbers: Vec<NumberType>,
} }