mirror of
https://github.com/Erreur32/cheat.git
synced 2024-12-22 05:32:13 +01:00
Update cheat
python3 + add color + remove sheet
This commit is contained in:
parent
aa1e12625e
commit
fec0382892
1 changed files with 16 additions and 10 deletions
26
bin/cheat
26
bin/cheat
|
@ -1,28 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/python3
|
||||
|
||||
"""cheat
|
||||
|
||||
Create and view cheatsheets on the command line.
|
||||
|
||||
Usage:
|
||||
cheat <cheatsheet>
|
||||
cheat -e <cheatsheet>
|
||||
cheat -s <keyword>
|
||||
cheat -l
|
||||
cheat -d
|
||||
cheat -v
|
||||
\033[1;32mcheat\033[0m <cheatsheet>
|
||||
\033[1;32mcheat\033[0m -e <cheatsheet>
|
||||
\033[1;32mcheat\033[0m -s <keyword> [<cheatsheet>]
|
||||
\033[1;32mcheat\033[0m -l
|
||||
\033[1;32mcheat\033[0m -d
|
||||
\033[1;32mcheat\033[0m -v
|
||||
\033[1;32mcheat\033[0m -r <cheatsheet>
|
||||
|
||||
Options:
|
||||
-d --directories List directories on CHEATPATH
|
||||
-e --edit Edit cheatsheet
|
||||
-l --list List cheatsheets
|
||||
-s --search Search cheatsheets for <keyword>
|
||||
-s --search Search cheatsheets for <keyword> and [<cheatsheet>] file
|
||||
-v --version Print the version number
|
||||
-r --remove Delete Cheatsheet
|
||||
|
||||
Examples:
|
||||
|
||||
To view the `tar` cheatsheet:
|
||||
cheat tar
|
||||
\033[1;31m cheat \033[0m tar
|
||||
|
||||
To edit (or create) the `foo` cheatsheet:
|
||||
cheat -e foo
|
||||
|
@ -58,7 +60,11 @@ if __name__ == '__main__':
|
|||
|
||||
# search among the cheatsheets
|
||||
elif options['--search']:
|
||||
print(colorize(sheets.search(options['<keyword>'])))
|
||||
print(colorize(sheets.search(options['<keyword>'], options['<cheatsheet>'])))
|
||||
|
||||
# remove File in the cheatsheets
|
||||
elif options['--remove']:
|
||||
sheet.remove(options['<cheatsheet>'])
|
||||
|
||||
# print the cheatsheet
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue