piotrmurach/tty

suggestion: odds and ends

gurgeous opened this issue · 3 comments

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.

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.

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?

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