🐋 Docker Names
Docker_Names 🐋 is a port for Moby’s name generation for the Deno ecosystem.
With this module you’ll be able to generates names like:
- ecstatic_rubin
- elastic_yonath66
- blissful@elgamal
- boring&wozniak2
💭 Inspiration
This project is inspired by the awesome folks at moby/moby and their idea to pay homage to great scientists and “hackers” when creating names for running containers.
This also builds on my previous port for the .NET Core ecosystem DockerNames.
▶ Quickstart
Import this module and you’ll have access to two functions:
generateName(retry?: int): Generates a name with an adjective, a personality and a_separator. If retry is set and greated than 0 it’ll be appendedgenerateNameCustom(seprator: string, retry?: int): Same asgenerateNamebut allows for a custom separator.
Sample
This snippet will allow you to use deno repl to play with name generation:
> let names;
// undefined
// Importing our mod into the REPL
> import("./mod.ts").then(r => names = r)
// Promise { <pending> }
> names.generateName()
// magical_satoshi
> names.generateName(22)
// flamboyant_goldberg22
> names.generateNameCustom('***')
// vigorous***bohr
> names.generateNameCustom('***', 99)
// objective***jennings99👨💻 Command Line
You can use this module as a Command Line tool by running deno install -n docker-names .\cli.ts, which will create a new alias docker-names within your terminal.
The CLI accepts commands in the following order:
h -h --help | g -g --generate: The command itself: Help or Generate, defaults togretry | separator: A string or a number. If a number is informed it’ll be used asretry, else as aseparatorseparator: If aretryis set this can be used to pick astringas separator
The following are all valid inputs for the CLI:
deno run .\cli.ts ... results in something_somegion
deno run .\cli.ts g "@" ... results in something@someone
deno run .\cli.ts g 10 ... results in something_someone10
deno run .\cli.ts g 20 "@" ... results in something@someone20