piotrmurach / tty

Toolkit for developing sleek command line apps.
https://ttytoolkit.org
MIT License
2.5k stars 78 forks source link

suggestion: odds and ends #25

Closed gurgeous closed 7 years ago

gurgeous commented 8 years ago

Last one, I promise. Here are a few more common helpers that we tend to use in scripts:

# Who is the current user?
def whoami

# Return true if the current user is "root".
def root?

# Return the md5 checksum for the file at +path+.
def md5_file(path)

# Return the md5 checksum for +str+.
def md5_string(str)

# Return a random alphanumeric string of length +len+.
def random_string(len)

I'd be happy to add these too! I might need some guidance on where to place them.

piotrmurach commented 8 years ago

Thank you very much for all the suggestions. It's super nice to have feedback.

On general note, I plan for the tty to be more of a meta gem with scaffolding methods. Therefore, I would see this kind of functionality implemented more in external dependencies.

gurgeous commented 8 years ago

Thanks, happy to help. I'd love to replace all my ad-hoc util methods with tty plugins. Should I put one together for these guys?

piotrmurach commented 7 years ago

checksum_file from tty-file generates checksums for a file or string.