From fec0382892620c8660188c2d0064a386221c4899 Mon Sep 17 00:00:00 2001 From: Erreur32 Date: Sat, 24 Feb 2018 17:42:32 +0100 Subject: [PATCH] Update cheat python3 + add color + remove sheet --- bin/cheat | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/bin/cheat b/bin/cheat index 9213639..932555c 100755 --- a/bin/cheat +++ b/bin/cheat @@ -1,28 +1,30 @@ -#!/usr/bin/env python +#!/usr/bin/python3 """cheat Create and view cheatsheets on the command line. Usage: - cheat - cheat -e - cheat -s - cheat -l - cheat -d - cheat -v + \033[1;32mcheat\033[0m + \033[1;32mcheat\033[0m -e + \033[1;32mcheat\033[0m -s [] + \033[1;32mcheat\033[0m -l + \033[1;32mcheat\033[0m -d + \033[1;32mcheat\033[0m -v + \033[1;32mcheat\033[0m -r Options: -d --directories List directories on CHEATPATH -e --edit Edit cheatsheet -l --list List cheatsheets - -s --search Search cheatsheets for + -s --search Search cheatsheets for and [] 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['']))) + print(colorize(sheets.search(options[''], options['']))) + + # remove File in the cheatsheets + elif options['--remove']: + sheet.remove(options['']) # print the cheatsheet else: