From 118823838142ee4811e68f41c42a713b24a6a0a2 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Tue, 30 Jul 2013 22:48:07 -0400 Subject: [PATCH] Got a working version. --- README | 0 README.md | 2 ++ cheat | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ cheat1 | 38 -------------------------------------- cheat2 | 24 ------------------------ 5 files changed, 50 insertions(+), 62 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100755 cheat delete mode 100644 cheat1 delete mode 100755 cheat2 diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e6a453d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +Cheat +===== diff --git a/cheat b/cheat new file mode 100755 index 0000000..39952ed --- /dev/null +++ b/cheat @@ -0,0 +1,48 @@ +#!/usr/bin/env python +import sys + +# Create a dictionary of cheat sheets +cheats = { + +'find' : ''' +''', + +'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: + + + + + +''', + +'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 the cheatsheet if it exists +print cheats[sys.argv[1]] if sys.argv[1] in cheats.keys() else 'No cheatsheet found.' diff --git a/cheat1 b/cheat1 deleted file mode 100644 index 66a4a80..0000000 --- a/cheat1 +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env ruby - -# look up the first argument passed to the script -cheat = case ARGV[0] -when 'git' - ' - Need notes on how to: - 1) Set colors - 2) Set name / email - 3) View/set remote branches - ' - -when 'tar' - ' - tar - - To extract an uncompressed archive: - tar -xvf /path/to/foo.tar - - To extract a compressed archive: - tar -xzvf /path/to/foo.tgz - - To create a compressed archive: - tar -czvf /path/to/foo.tgz /path/to/foo/ - - ' - -else - 'No cheat sheet available.' - -end - - -# find - -# output -puts cheat - diff --git a/cheat2 b/cheat2 deleted file mode 100755 index df50583..0000000 --- a/cheat2 +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env ruby - -# Create a hash of cheatsheets -cheats = { - 'tar' => ' -some long string -some long string -some long string -some long string -some long string -some long string - ', - - 'git' => ' -some long string about git -some long string about git -some long string about git -some long string about git -some long string about git - ', -} - -# output -puts cheats[ARGV[0]] || 'No cheat sheet found.'