cheat-fork-echo/cheat

58 lines
1.1 KiB
Text
Raw Normal View History

2013-07-31 04:48:07 +02:00
#!/usr/bin/env python
import sys
2013-07-31 05:25:36 +02:00
# assemble a keyphrase out of all params passed to the script
keyphrase = ' '.join(sys.argv[1:])
# create a dictionary of cheatsheets
cheatsheets = {
2013-07-31 04:48:07 +02:00
'find' : '''
2013-07-31 05:25:36 +02:00
executable perms
file not directory
directory not file
2013-07-31 04:48:07 +02:00
''',
'git' : '''
To set your identify:
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
To enable color:
git config --global color.ui true
''',
'ln' : '''
To create a symlink:
2013-07-31 05:25:36 +02:00
@todo: complete this
2013-07-31 04:48:07 +02:00
''',
'tar' : '''
To extract an uncompressed archive:
tar -xvf /path/to/foo.tar
To extract a gz archive:
tar -xzvf /path/to/foo.tgz
To create a gz archive:
tar -czvf /path/to/foo.tgz /path/to/foo/
To extract a bz2 archive:
tar -xjvf /path/to/foo.tgz
To create a bz2 archive:
tar -cjvf /path/to/foo.tgz /path/to/foo/
''',
}
# print help if requested
if keyphrase in ['help', '--help', '-h']:
print 'Available cheatsheets:'
for key in cheatsheets:
2013-07-31 05:25:36 +02:00
print key
exit()
# print the cheatsheet if it exists
print cheatsheets[keyphrase] if keyphrase in cheatsheets.keys() else 'No cheatsheet found.'