adjective-adjective-animal/cli
2015-11-02 09:24:49 -07:00
..
scripts Remove CMD from Docker image, so it's all business by default! 2015-11-02 09:24:08 -07:00
src Use Default trait for Generator & Name types. 2015-11-01 08:14:00 -07:00
Cargo.lock Release 0.10.0. 2015-11-01 08:30:50 -07:00
Cargo.toml Release 0.10.0. 2015-11-01 08:30:50 -07:00
README.md Add README for CLI subproject. 2015-11-02 09:24:49 -07:00

names

Random name generator tool that gives you Heroku or Docker-style names.

Usage

Simple! Run without any parameters, you get a name:

> names
selfish-change

Need more? Tell it how many:

> names 10
rustic-flag
nondescript-crayon
picayune-map
elderly-cough
skinny-jeans
neat-rock
aware-sponge
psychotic-coast
brawny-event
tender-oatmeal

Not random enough? How about adding a 4-number pad:

> names --number 5
imported-rod-9680
thin-position-2344
hysterical-women-5647
volatile-pen-9210
diligent-grip-4520

If you're ever confused, at least there's help:

> names --help
names 0.10.0

Author: Fletcher Nichol <fnichol@nichol.ca>

A random name generator with results like `delirious-pail'.

USAGE:
        names [FLAGS] [ARGS]

FLAGS:
    -h, --help       Prints help information
    -n, --number     Adds a random number to the name(s)
    -V, --version    Prints version information

ARGS:
    amount    Number of names to generate (default: 1)

Installation

GitHub releases

There are binary builds for Mac OS X (referred to as "Darwin") and Linux (a small, self-contained static binary) available through the project's GitHub releases.

Docker images

If Docker is more your speed, there's a speedy teeny tiny image (~1MB) on the Docker hub at fnichol/names. It's pretty easy to get started:

> docker run fnichol/names 4
furtive-polish
modern-business
alive-sun
tremendous-line

Building from source

If you want (or need) to build the CLI from source, the following should not take too long. Note that you'll need a version of Rust (and Cargo which ships with the Rust distributions) before running:

> git clone https://github.com/fnichol/names.git
> cd names/cli
> cargo build --release
# test it out
> ./target/release/names

A static binary on Linux?

This project was used by its author to experiment with producing static binaries on Linux from a Rust project that has no external dependencies. This was done using a special build of Rust that supports the musl libc project, available via the fnichol/rust:1.4.0-musl Docker image. Here's an example building the CLI to a static ELF binary on Linux:

> git clone https://github.com/fnichol/names.git
> cd names
> docker run --rm -ti -v `pwd`:/src -w /src/cli fnichol/rust:1.4.0-musl cargo build --release --target=x86_64-unknown-linux-musl

> docker run --rm -ti -v `pwd`:/src fnichol/rust:1.4.0-musl du -h ./cli/target/x86_64-unknown-linux-musl/release/names
1.5M    ./cli/target/x86_64-unknown-linux-musl/release/names

> docker run --rm -ti -v `pwd`:/src fnichol/rust:1.4.0-musl ldd ./cli/target/x86_64-unknown-linux-musl/release/names
        not a dynamic executable

> docker run --rm -ti -v `pwd`:/src fnichol/rust:1.4.0-musl file ./cli/target/x86_64-unknown-linux-musl/release/names
./cli/target/x86_64-unknown-linux-musl/release/names: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=6ad327ca3a5b21c42fa158832d89f6e9b0fc8e73, not stripped

A variant of this approach is used in the build_linux.sh script, which additional strips the binary and produces a Zip archive and SHA 256 checksum:

> git clone https://github.com/fnichol/names.git
> cd names
> ./cli/scripts/build_linux.sh 0.10.0

> du -h ./cli/target/x86_64-unknown-linux-musl/release/names
996K    ./cli/target/x86_64-unknown-linux-musl/release/names

> file ./cli/target/x86_64-unknown-linux-musl/release/names
./cli/target/x86_64-unknown-linux-musl/release/names: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

> du -csh ./cli/target/names*.zip*
396K    cli/target/names_0.10.0_linux_x86_64.zip
4.0K    cli/target/names_0.10.0_linux_x86_64.zip.sha256
400K    total

User feedback

Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue.

Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

Authors

Created and maintained by [Fletcher Nichol][fnichol] (fnichol@nichol.ca)

License

MIT (see LICENSE-MIT)