summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Sitkevich <1553398+sitkevij@users.noreply.github.com>2021-02-23 08:53:40 -0800
committerGitHub <noreply@github.com>2021-02-23 08:53:40 -0800
commit959f88dfd7296d7a8fe72a09b11c8e6fcc55b763 (patch)
tree14f5d6b8e0781aececafcb8d2210fd13a786c6df
parentb0a844a83c9c15f2416fa7e5748347fbe1ee4a77 (diff)
parent2bba3054ece3f8db162536936548375f3931d2ed (diff)
Merge pull request #55 from sitkevij/developv0.4.1
0.4.1 develop
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--Makefile3
-rw-r--r--README.md22
-rw-r--r--src/lib.rs2
-rw-r--r--src/main.rs6
7 files changed, 30 insertions, 9 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ed9a012..3bbc1bc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,6 +10,8 @@ on:
- develop
- main
- master
+ schedule:
+ - cron: "0 9 * * *"
env:
RUST_BACKTRACE: full
diff --git a/Cargo.lock b/Cargo.lock
index ea174b4..4407e28 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -77,7 +77,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
[[package]]
name = "hx"
-version = "0.4.0"
+version = "0.4.1"
dependencies = [
"ansi_term 0.12.1",
"assert_cmd",
diff --git a/Cargo.toml b/Cargo.toml
index 5e9965e..78069bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ include = ["src/**/*","Cargo.toml","Cargo.lock", "README.md"]
license = "MIT"
name = "hx"
readme ="README.md"
-version = "0.4.0"
+version = "0.4.1"
edition = "2018"
# see https://doc.rust-lang.org/cargo/reference/manifest.html
diff --git a/Makefile b/Makefile
index a20d463..bbef150 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,9 @@ docker-build:
docker-run:
cat README.md | docker run -i sitkevij/hx:latest
+deb:
+ cargo deb
+
clean: ## Remove all artifacts
rm -rf $(DEBUG_DIR)
rm -rf $(RELEASE_DIR)
diff --git a/README.md b/README.md
index cd6f904..b5e0007 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ $ hx tests/files/alphanumeric.txt
bytes: 68
```
-`hx` also accepts stdin as input.
+[hx](https://github.com/sitkevij/hex) also accepts stdin as input.
```sh
cat "tests/files/alphanumeric.txt" | hx
@@ -93,7 +93,7 @@ If `<USERDIR>/.cargo/bin` is part of the `PATH` environment variable, `hx` shoul
### debian install
```sh
-curl -sLO https://github.com/sitkevij/hex/releases/download/v0.4.0/hx_0.4.0_amd64.deb && dpkg -i hx_0.4.0_amd64.deb
+curl -sLO https://github.com/sitkevij/hex/releases/download/v0.4.1/hx_0.4.1_amd64.deb && dpkg -i hx_0.4.1_amd64.deb
```
### docker run
@@ -104,7 +104,7 @@ cat README.md | docker run -i sitkevij/hx:latest
## features
-### output arrays in `rust`, `c`, `golang`, `python`, `kotlin`, or `java`
+### output arrays in `rust`, `c`, `golang`, `python`, `kotlin`, `java`, or `swift`
`hx` has a feature which can output the input file bytes as source code arrays.
@@ -164,10 +164,24 @@ byte[] a = new byte[]{
};
```
+#### swift array: -as
+
+```sh
+$ hx -as -c8 tests/files/tiny.txt
+let a: [UInt8] = [
+ 0x69, 0x6c, 0x0a
+]
+```
+
### NO_COLOR support
`hx` will honor the NO_COLOR environment variable. If set, no color will be output to the terminal.
+Rust `no_color` crate:
+
+* <https://crates.io/crates/no_color>
+* <https://github.com/sitkevij/no_color>
+
## manual
```txt
@@ -198,4 +212,4 @@ ARGS:
## license
-[MIT](LICENSE)
+MIT
diff --git a/src/lib.rs b/src/lib.rs
index 4fbcc0a..37634e3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -399,6 +399,7 @@ pub fn output_array(
"p" => writeln!(locked, "a = [")?,
"k" => writeln!(locked, "val a = byteArrayOf(")?,
"j" => writeln!(locked, "byte[] a = new byte[]{{")?,
+ "s" => writeln!(locked, "let a: [UInt8] = [")?,
_ => writeln!(locked, "unknown array format")?,
}
let mut i: u64 = 0x0;
@@ -424,6 +425,7 @@ pub fn output_array(
"g" => "}",
"p" => "]",
"k" => ")",
+ "s" => "]",
_ => "unknown array format",
}
)
diff --git a/src/main.rs b/src/main.rs
index 9e0b9c1..3fc5972 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -60,8 +60,8 @@ fn main() {
.short("a")
.long(ARG_ARR)
.value_name("array_format")
- .help("Set source code format output: rust (r), C (c), golang (g), python (p), kotlin (k), java (j)")
- .possible_values(&["r", "c", "g", "p", "k", "j"])
+ .help("Set source code format output: rust (r), C (c), golang (g), python (p), kotlin (k), java (j), swift (s)")
+ .possible_values(&["r", "c", "g", "p", "k", "j", "s"])
.takes_value(true),
)
.arg(
@@ -93,7 +93,7 @@ fn main() {
_ => false,
};
if !suppress_error {
- eprintln!("{} {}", "error:", err);
+ eprintln!("error: {}", err);
process::exit(1);
}
}