Giter Club home page Giter Club logo

dtool's Introduction

dtool

Build Status Crates.io

dtool is a command-line tool collection to assist development

Table of Contents

Description

Now dtool supports:

Usage

dtool does different works by different sub commands:

Sub command Desc Example
h2s Convert hex to UTF-8 string
v0.1.0
$ dtool h2s 0x61626364
abcd
s2h Convert UTF-8 string to hex
v0.1.0
$ dtool s2h abcd
0x61626364
h2b Convert hex to binary
v0.1.0
$ dtool h2b 0x61626364
abcd
b2h Convert binary to hex
v0.1.0
$ dtool b2h abcd
0x61626364
...

View full usage document

  • Besides the sub command help, dtool provides a sub command usage to show examples:
$ dtool usage
Usage
----------------------------------------------------------
 h2s  Convert hex to UTF-8 string  $ dtool h2s 0x61626364 
      v0.1.0                       abcd 
----------------------------------------------------------
...
  • You can search usage with a keyword:
$ dtool usage -s md5
Usage
-------------------------------------------------------
 hash  Hex to hash  $ dtool hash -a md5 0x616263 
       MD5          0x900150983cd24fb0d6963f7d28e17f72 
       v0.2.0        
-------------------------------------------------------

Tips

pipe

convert a string to base64

$ echo -n abc | dtool s2h | dtool h2b64
YWJj

convert a encoded timestamp to date

$ echo -n 2c28e75d | dtool nd -tu32 | dtool ts2d
2019-12-04 11:29:48

convert a jpeg to base64

$ cat pic.jpg | dtool b2h | dtool h2b64
/9j/4AAQSkZJR...

calculate file md5

$ cat pic.jpg | dtool b2h | dtool hash -a md5
0x1884b72e23b0c93320bac6b050478ff4

Installation

Homebrew

$ brew install guoxbin/guoxbin/dtool

Recommend! Homebrew will install shell completion for bash, fish, and zsh along with dtool

Arch Linux

There is an AUR package for dtool that includes shell completion for bash, fish, and zsh.

git clone https://aur.archlinux.org/dtool.git
cd dtool
makepkg -si

Cargo

$ cargo install dtool

dtool's People

Contributors

atul9 avatar dependabot[bot] avatar dylan-dpc avatar fmckeogh avatar guoxbin avatar wezm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

dtool's Issues

Tag releases for easier packaging

This looks like a really useful tool. I actually started building a very similar tool in Rust for doing hex conversion that other day but dtool does that and more! I'd like to create an AUR package for it. It's best to build OS packages like this from downloadable tar archives so that the source code can be checked against a hash digest like SHA256. Would it be possible to create a git tag for releases? GitHub will then make tarballs available for each tagged release at: https://github.com/guoxbin/dtool/releases which I can use to build the package.

Cannot compiled due to transitive dependency on zeroize

Last version of dtool depends on schnorrkel 0.8.5 which depends on zeroize 0.9.x, it seems all zeroize packages < 1.0 have been purged.

error: failed to compile `dtool v0.10.1`, intermediate artifacts can be found at `C:\Users\gim91\AppData\Local\Temp\cargo-installjjerSE`

Caused by:
  failed to select a version for the requirement `zeroize = "^0.9.3"`
  candidate versions found which didn't match: 1.3.0, 1.2.0, 1.1.1, ...
  location searched: crates.io index
  required by package `schnorrkel v0.8.5`
      ... which is depended on by `dtool v0.10.1`

v0.10.0 release does not build

rustc version: rustc 1.45.2 (d3fb005a3 2020-07-31)

error[E0405]: cannot find trait `PrehashSignature` in crate `signature`
  --> /Users/lusheng.lls/.cargo/registry/src/github.com-1ecc6299db9ec823/signatory-secp256k1-0.17.0/src/lib.rs:25:10
   |
25 | #[derive(Signer)]
   |          ^^^^^^ not found in `signature`
   |
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0405]: cannot find trait `PrehashSignature` in crate `signature`
  --> /Users/lusheng.lls/.cargo/registry/src/github.com-1ecc6299db9ec823/signatory-secp256k1-0.17.0/src/lib.rs:80:39
   |
80 | #[derive(Clone, Debug, Eq, PartialEq, Verifier)]
   |                                       ^^^^^^^^ not found in `signature`
   |
   = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0405`.
error: could not compile `signatory-secp256k1`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `dtool v0.10.0`, intermediate artifacts can be found at `/var/folders/8d/h3lyjgz14296j_lw7chgf5hc0000gp/T/cargo-installyB8mOX`

Maybe it needs to update lockfile for signatory-secp256k1?

Suggestion: flatter API

I would love to be able to type:

echo "Hello World" | dtool snake_case
cat file.txt | dtool md5

This would make it much easier to remember the available commands.

For A2B style commands, it would be nice to have a long form available. For example

dtool hex to utf8

The short forms like h2s are probably good for typing quickly, but unfortunately it still ends up slower if I have to look up the command. I think I would be able to remember hex more easily than I am able to remember h.

Add Windows Support

For now, the latest version (v0.8.0) can not be built succesfully on Windows. Is there any plan to support Windows? Thanks!
Versions:

  • rustc 1.43.0-nightly (8aa9d2014 2020-02-21)
  • cargo 1.43.0-nightly (e02974078 2020-02-18)
>_ cargo install dtool
    Updating crates.io index
  Downloaded dtool v0.8.0
  Downloaded 1 crate (59.8 KB) in 2.37s
  Installing dtool v0.8.0
  Downloaded ring-fork-dtool v0.16.12
  Downloaded zeroize_derive v1.0.0
  Downloaded schnorrkel v0.8.5
  Downloaded merlin v1.3.0
  Downloaded curve25519-dalek v1.2.3
  Downloaded zeroize v0.9.3
   Compiling winapi v0.3.8
   Compiling byteorder v1.3.4
   Compiling proc-macro2 v1.0.8
   Compiling typenum v1.11.2
   Compiling rand_core v0.4.2
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.15
   Compiling cc v1.0.41
   Compiling autocfg v0.1.7
   Compiling autocfg v1.0.0
   Compiling serde v1.0.104
   Compiling byte-tools v0.3.1
   Compiling memchr v2.3.3
   Compiling subtle v2.2.2
   Compiling opaque-debug v0.2.3
   Compiling lazy_static v1.4.0
   Compiling getrandom v0.1.14
   Compiling libc v0.2.67
   Compiling fake-simd v0.1.2
   Compiling cfg-if v0.1.10
   Compiling ryu v1.0.2
   Compiling arrayvec v0.4.12
   Compiling keccak v0.1.0
   Compiling bitflags v1.2.1
   Compiling build_const v0.2.1
   Compiling gcc v0.3.55
   Compiling unicode-width v0.1.7
   Compiling itoa v0.4.5
   Compiling regex-syntax v0.6.14
   Compiling nodrop v0.1.14
   Compiling dtoa v0.4.5
   Compiling strsim v0.8.0
   Compiling unicode-segmentation v1.6.0
   Compiling spin v0.5.2
   Compiling entities v1.0.1
   Compiling failure v0.1.6
   Compiling zeroize v0.9.3
   Compiling encode_unicode v0.3.6
   Compiling rustc-serialize v0.3.24
   Compiling untrusted v0.7.0
   Compiling vec_map v0.8.1
   Compiling base64 v0.11.0
   Compiling md5 v0.7.0
   Compiling urlencoding v1.0.0
   Compiling hex v0.4.2
   Compiling rand_core v0.3.1
   Compiling block-padding v0.1.5
   Compiling thread_local v1.0.1
   Compiling rand_pcg v0.1.2
   Compiling rand_chacha v0.1.1
   Compiling rand v0.6.5
   Compiling num-traits v0.2.11
   Compiling num-integer v0.1.42
   Compiling indexmap v1.3.2
   Compiling textwrap v0.11.0
   Compiling crc v1.8.1
   Compiling escaper v0.1.0
   Compiling heck v0.3.1
   Compiling rand_hc v0.1.0
   Compiling rand_xorshift v0.1.1
   Compiling rand_isaac v0.1.1
   Compiling regex-automata v0.1.8
   Compiling quote v1.0.2
   Compiling rust-crypto v0.2.36
   Compiling csv-core v0.1.10
   Compiling aho-corasick v0.7.8
   Compiling generic-array v0.12.3
   Compiling clear_on_drop v0.2.3
   Compiling secp256k1 v0.15.5
   Compiling ring-fork-dtool v0.16.12
   Compiling digest v0.8.1
   Compiling block-buffer v0.7.3
   Compiling regex v1.3.4
   Compiling rand_os v0.1.3
   Compiling rand_jitter v0.1.4
   Compiling time v0.1.42
   Compiling atty v0.2.14
   Compiling rand v0.4.6
   Compiling dirs v1.0.5
   Compiling rand v0.5.6
   Compiling sha2 v0.8.1
   Compiling ripemd160 v0.8.0
   Compiling sha3 v0.8.2
   Compiling serde_test v1.0.104
   Compiling bstr v0.2.11
   Compiling parity-codec v3.5.4
   Compiling clap v2.33.0
   Compiling term v0.5.2
   Compiling rand v0.3.23
   Compiling chrono v0.4.10
   Compiling yogcrypt v0.0.0
error: failed to run custom build command for `ring-fork-dtool v0.16.12`

Caused by:
  process didn't exit successfully: `C:\Users\WINTER~1\AppData\Local\Temp\cargo-installd2xAdG\release\build\ring-fork-dtool-ad22c67c879656d3\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at '"C:\\Users\\Winterreise\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\ring-fork-dtool-0.16.12\\pregenerated\\aes-x86_64-elf.obj": Os { code: 2, kind: NotFound, message: "系统找不到指定的文件。" }', C:\Users\Winterreise\.cargo\registry\src\github.com-1ecc6299db9ec823\ring-fork-dtool-0.16.12\build.rs:753:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

warning: build failed, waiting for other jobs to finish...
error: failed to compile `dtool v0.8.0`, intermediate artifacts can be found at `C:\Users\WINTER~1\AppData\Local\Temp\cargo-installd2xAdG`

Caused by:
  build failed

can't compile on apple silicon M1

Compilation fails because of crate ring-fork-dtool with

error[E0308]: mismatched types
   --> /Users/thomvil/.cargo/registry/src/github.com-1ecc6299db9ec823/ring-fork-dtool-0.16.13/src/cpu.rs:187:56
    |
187 |         pub fn available(&self, _: super::Features) -> bool {
    |                ---------                               ^^^^ expected `bool`, found `()`
    |                |
    |                implicitly returns `()` as its body has no tail or `return` expression

Could it be possible you need to explicitly support aarch64-apple-darwin? I think the original crate ring could already have a solution that would suffice? See this commit

0.7.0 does not build with --locked

Attempting to build the 0.7.0 release with cargo build --release --locked results in an error:

    Updating crates.io index
error: the lock file /home/wmoore/Projects/aur/dtool/src/dtool-0.7.0/Cargo.lock needs to be updated but --locked was passed to prevent this

I use --locked when building the AUR package to ensure that the build is reproducible. It appears that you have not committed the Cargo.lock file. This is recommended for binary packages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.