angularsen / yawg

Yet Another Word Generator - Node CLI to generate XKCD inspired passwords, using common English words that are easy to spell.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YAWG - Yet Another Word Generator

Node CLI to generate XKCD inspired passwords, using common English words that are easy to spell and type in manually.

https://www.npmjs.com/package/yawg

Install

Install yawg globally with NPM package manager included with NodeJS:

$ npm install -g yawg        

Alternatively with Yarn package manager:

$ yarn global add yawg

Then run it:

$ yawg
cheese packet wish

Parameters

$ yawg -h
yawg - Yet Another Word Generator

version: 1.2.3

Required parameters: (none)

Optional parameters:
--delimiter=' '     Delimiter between words
--minLength=12      Min length of phrase
--maxLength=25      Max length of phrase
--minWords=3        Min number of words
--maxWords=5        Max number of words
--minWordLength=1   Min word length
--maxWordLength=8   Max word length
--attempts=10000    Max attempts per phrase
--count=1           Number of phrases to generate
    alias: -n
--help              Show this screen
    alias: -h

Examples

Copy phrase to clipboard

$ yawg | clip

Multiple phrases

$ yawg -n 10
dans mainly fly tray luke
yen craft marco ill jobs
ran situated bouquet
toys que wrist achieve
bless worry filme craft
justin shame toronto
trader reset dui gen lead
str disks antigua nest
marvel enables moms
trusted cleared unit

Short words only

$ yawg -n3 --maxWordLength=4
fork my core
mat fair hong
bras arm foul

Long phrases

$ yawg -n3 --minLength=25 --maxLength=50
offices language myrtle altered
recipes emission involves audience brighton
detailed exhibit industry

Node API

You can require this package in your NodeJS code and pass in the options as an object argument.

Example:

'use strict';

var yawg = require('yawg');

try {
    var phrase = yawg({
        minWords: 4,
        maxLength: 50,
        attempts: 100,
    });
    console.log('Phrase is: ' + phrase);
} catch (err) {
    // Not able to produce a phrase that mathed the constraints of the parameters.
    // Example: --maxLength=10 --minWords=5 --minWordLength=3  # Can only generate phrase of minimum length 5*13=15
}

Troubleshooting

  1. Sometimes Yarn on Windows does not properly configure the PATH environment variable. Make sure PATH is properly set up.
    • Find the global yarn bin path: $ yarn global bin # Ex: C:\Users\Andreas\AppData\Local\Yarn\bin
    • Append path to PATH env variable

About

Yet Another Word Generator - Node CLI to generate XKCD inspired passwords, using common English words that are easy to spell.

License:MIT License


Languages

Language:JavaScript 100.0%