CI | ![CI Status][badge-ci-overall] |
Latest Version | |
Documentation | |
Crate Downloads | |
GitHub Downloads | ![Github downloads][badge-github-dl] |
Docker Pulls | ![Docker pulls][badge-docker-pulls] |
License |
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.11.0
Fletcher Nichol <fnichol@nichol.ca>
A random name generator with results like "delirious-pail"
USAGE:
names [FLAGS] [AMOUNT]
ARGS:
<AMOUNT> Number of names to generate [default: 1]
FLAGS:
-h, --help Prints help information
-n, --number Adds a random number to the name(s)
-V, --version Prints version information
An installer is provided at https://fnichol.github.io/names/install.sh which installs a suitable pre-built binary for common systems such as Linux, macOS, Windows, and FreeBSD. It can be downloaded and run locally or piped into a shell interpreter in the "curl-bash" style as shown below. Note that if you're opposed to this idea, feel free to check some of the alternatives below.
To install the latest release for your system into $HOME/bin
:
curl -sSf https://fnichol.github.io/names/install.sh | sh
When the installer is run as root
the installation directory defaults to
/usr/local/bin
:
curl -sSf https://fnichol.github.io/names/install.sh | sudo sh
A nightly release built from HEAD
of the main branch is available which can
also be installed:
curl -sSf https://fnichol.github.io/names/install.sh \
| sh -s -- --release=nightly
For a full set of options, check out the help usage with:
curl -sSf https://fnichol.github.io/names/install.sh | sh -s -- --help
Each release comes with binary artifacts published in GitHub
Releases. The install.sh
program downloads its artifacts
from this location so this serves as a manual alternative. Each artifact ships
with MD5 and SHA256 checksums to help verify the artifact on a target system.
A minimal image ships with each release (including a nightly built version
from HEAD
of the main branch) published to Docker Hub. The
entrypoint invokes the binary directly, so any arguments to docker run
will be
passed to the program. For example, to display the full help usage:
docker run fnichol/names --help
If Rust is installed on your system, then installing with Cargo is straight forward with:
cargo install names
To install from source, you can clone the Git repository, build with Cargo and copy the binary into a destination directory. This will build the project from the latest commit on the main branch, which may not correspond to the latest stable release:
> git clone https://github.com/fnichol/names.git
> cd names
> cargo build --release
> cp ./target/release/names /dest/path/
This crate provides a generate that constructs random name strings suitable for use in container instances, project names, application instances, etc.
The name Generator
implements the Iterator
trait so it can be used with
adapters, consumers, and in loops.
This crate is on crates.io and can be used by
adding names
to your dependencies in your project's Cargo.toml
file:
[dependencies]
names = { version = "0.14.0", default-features = false }
The easiest way to get started is to use the default Generator
to return a
name:
use names::Generator;
let mut generator = Generator::default();
println!("Your project is: {}", generator.next().unwrap());
// #=> "Your project is: rusty-nail"
If more randomness is required, you can generate a name with a trailing 4-digit number:
use names::{Generator, Name};
let mut generator = Generator::with_naming(Name::Numbered);
println!("Your project is: {}", generator.next().unwrap());
// #=> "Your project is: pushy-pencil-5602"
If you would rather supply your own custom adjective and noun word lists, you can provide your own by supplying 2 string slices. For example, this returns only one result:
use names::{Generator, Name};
let adjectives = &["imaginary"];
let nouns = &["roll"];
let mut generator = Generator::new(adjectives, nouns, Name::default());
assert_eq!("imaginary-roll", generator.next().unwrap());
Operating System | Target | Stable Rust |
---|---|---|
FreeBSD | x86_64-unknown-freebsd |
![FreeBSD Build Status][badge-ci-build-x86_64-unknown-freebsd] |
Linux | arm-unknown-linux-gnueabihf |
![Linux Build Status][badge-ci-build-arm-unknown-linux-gnueabihf] |
Linux | aarch64-unknown-linux-gnu |
![Linux Build Status][badge-ci-build-aarch64-unknown-linux-gnu] |
Linux | i686-unknown-linux-gnu |
![Linux Build Status][badge-ci-build-i686-unknown-linux-gnu] |
Linux | i686-unknown-linux-musl |
![Linux Build Status][badge-ci-build-i686-unknown-linux-musl] |
Linux | x86_64-unknown-linux-gnu |
![Linux Build Status][badge-ci-build-x86_64-unknown-linux-gnu] |
Linux | x86_64-unknown-linux-musl |
![Linux Build Status][badge-ci-build-x86_64-unknown-linux-musl] |
macOS | x86_64-apple-darwin |
![macOS Build Status][badge-ci-build-x86_64-apple-darwin] |
Windows | x86_64-pc-windows-msvc |
![Windows Build Status][badge-ci-build-x86_64-pc-windows-msvc] |
Note: The Minimum Supported Rust Version (MSRV) is also tested and can be viewed in the CI dashboard.
Status | |
---|---|
Lint | ![Lint Status][badge-ci-check-lint] |
Format | ![Format Status][badge-ci-check-format] |
This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to fnichol@nichol.ca.
If you have any problems with or questions about this project, please contact us through a GitHub issue.
You are invited to contribute to 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.
See the changelog for a full release history.
Created and maintained by Fletcher Nichol (fnichol@nichol.ca).
Licensed under the MIT license (LICENSE.txt).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.
[badge-ci-build-x86_64-unknown-freebsd]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-x86_64-unknown-freebsd.tar.gz [badge-ci-build-arm-unknown-linux-gnueabihf]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-arm-unknown-linux-gnueabihf.tar.gz [badge-ci-build-aarch64-unknown-linux-gnu]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-aarch64-unknown-linux-gnu.tar.gz [badge-ci-build-i686-unknown-linux-gnu]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-i686-unknown-linux-gnu.tar.gz [badge-ci-build-i686-unknown-linux-musl]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-i686-unknown-linux-musl.tar.gz [badge-ci-build-x86_64-unknown-linux-gnu]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-x86_64-unknown-linux-gnu.tar.gz [badge-ci-build-x86_64-unknown-linux-musl]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-x86_64-unknown-linux-musl.tar.gz [badge-ci-build-x86_64-apple-darwin]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-x86_64-apple-darwin.zip [badge-ci-build-x86_64-pc-windows-msvc]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=build-bin-names-x86_64-pc-windows-msvc.zip [badge-ci-check-format]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=check&script=format [badge-ci-check-lint]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=check&script=lint [badge-ci-overall]: https://img.shields.io/cirrus/github/fnichol/names/main?style=flat-square [badge-ci-test-nightly-freebsd]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-nightly-x86_64-unknown-freebsd [badge-ci-test-nightly-linux]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-nightly-x86_64-unknown-linux-gnu [badge-ci-test-nightly-macos]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-nightly-x86_64-apple-darwin [badge-ci-test-nightly-windows]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-nightly-x86_64-pc-windows-msvc [badge-ci-test-stable-freebsd]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-stable-x86_64-unknown-freebsd [badge-ci-test-stable-linux]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-stable-x86_64-unknown-linux-gnu [badge-ci-test-stable-macos]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-stable-x86_64-apple-darwin [badge-ci-test-stable-windows]: https://img.shields.io/cirrus/github/fnichol/names/staging?style=flat-square&task=test-stable-x86_64-pc-windows-msvc
[badge-docker-pulls]: https://img.shields.io/docker/pulls/fnichol/names.svg?style=flat-square
[badge-github-dl]: https://img.shields.io/github/downloads/fnichol/names/total.svg