Skip to content

Instantly share code, notes, and snippets.

@mrhammadasif
Last active October 4, 2022 15:56
Show Gist options
  • Save mrhammadasif/23e948eed927db04ca17ecd291f31431 to your computer and use it in GitHub Desktop.
Save mrhammadasif/23e948eed927db04ca17ecd291f31431 to your computer and use it in GitHub Desktop.
Generate fake data using Chance-CLI and copy to clipboard (MacOS)
fake() {
if [[ -z $1 ]]; then
echo "Provide a chance generator:"
exit 1
fi
tocopy=$(chance "$@")
echo $tocopy
echo $tocopy | tr -d '\n' | pbcopy
echo "\nCopied to Clipboard!"
}
@mrhammadasif
Copy link
Author

Steps to use it:

  1. Install chance-cli using npm i -g chance-cli
  2. Modify your bash profile (I'm assuming you would be using zsh so ~/.zshrc)
  3. Add the function mentioned above at the end of your config file

You can then use chance-cli generators for you

  • fake company
  • fake name
  • fake guid
  • fake string
    and it will be copied to your clipboard as well

@mrhammadasif
Copy link
Author

Update 2022-10-04: removed new-line characters when using pbcopy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment