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
|
"""cheat
|
||||||
|
|
||||||
Create and view cheatsheets on the command line.
|
Create and view cheatsheets on the command line.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
cheat <cheatsheet>
|
\033[1;32mcheat\033[0m <cheatsheet>
|
||||||
cheat -e <cheatsheet>
|
\033[1;32mcheat\033[0m -e <cheatsheet>
|
||||||
cheat -s <keyword>
|
\033[1;32mcheat\033[0m -s <keyword> [<cheatsheet>]
|
||||||
cheat -l
|
\033[1;32mcheat\033[0m -l
|
||||||
cheat -d
|
\033[1;32mcheat\033[0m -d
|
||||||
cheat -v
|
\033[1;32mcheat\033[0m -v
|
||||||
|
\033[1;32mcheat\033[0m -r <cheatsheet>
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-d --directories List directories on CHEATPATH
|
-d --directories List directories on CHEATPATH
|
||||||
-e --edit Edit cheatsheet
|
-e --edit Edit cheatsheet
|
||||||
-l --list List cheatsheets
|
-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
|
-v --version Print the version number
|
||||||
|
-r --remove Delete Cheatsheet
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
To view the `tar` cheatsheet:
|
To view the `tar` cheatsheet:
|
||||||
cheat tar
|
\033[1;31m cheat \033[0m tar
|
||||||
|
|
||||||
To edit (or create) the `foo` cheatsheet:
|
To edit (or create) the `foo` cheatsheet:
|
||||||
cheat -e foo
|
cheat -e foo
|
||||||
|
@ -58,7 +60,11 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# search among the cheatsheets
|
# search among the cheatsheets
|
||||||
elif options['--search']:
|
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
|
# print the cheatsheet
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue