mirror of
https://github.com/cheat/cheat.git
synced 2024-12-18 18:55:06 +01:00
Merge branch 'master' of https://github.com/shanahanjrs/cheat into shanahanjrs-master
* 'master' of https://github.com/shanahanjrs/cheat: Added 'import argparse' to 'cheat' Merge Added GPL3 license to top of 'cheat' as required.
This commit is contained in:
commit
f0a7362149
23
cheat
23
cheat
@ -1,6 +1,25 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
"""
|
||||||
|
cheat.py -- Quick, abridged man pages with examples (main routines)
|
||||||
|
Copyright (C) 2013, Chris Lane
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
DEFAULT_CHEAT_DIR = os.environ.get('DEFAULT_CHEAT_DIR') or \
|
DEFAULT_CHEAT_DIR = os.environ.get('DEFAULT_CHEAT_DIR') or \
|
||||||
@ -123,8 +142,8 @@ def main():
|
|||||||
# create/edit option
|
# create/edit option
|
||||||
option = sys.argv[1].lower()
|
option = sys.argv[1].lower()
|
||||||
if option in ['-e', '--edit', '-c', '--create']:
|
if option in ['-e', '--edit', '-c', '--create']:
|
||||||
# make sure EDITOR environment variable is set and that at least 3 arguments
|
# make sure EDITOR env variable is set and that at least
|
||||||
# are given
|
# 3 arguments are given
|
||||||
if 'EDITOR' not in os.environ:
|
if 'EDITOR' not in os.environ:
|
||||||
print('In order to use "create" or "edit" you must set your '
|
print('In order to use "create" or "edit" you must set your '
|
||||||
'EDITOR environment variable to your favorite editor\'s path')
|
'EDITOR environment variable to your favorite editor\'s path')
|
||||||
|
Loading…
Reference in New Issue
Block a user