Skip to content

Commit

Permalink
Remove ununsed commands
Browse files Browse the repository at this point in the history
  • Loading branch information
OrkoHunter committed Jan 13, 2019
1 parent 1aacacf commit db5ade2
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 38 deletions.
2 changes: 1 addition & 1 deletion keep/about.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__name__ = 'keep'
__version__ = '2.5'
__version__ = '2.5.2'
2 changes: 1 addition & 1 deletion keep/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ def cli(ctx, verbose):
"""
Keep and view shell commands in terminal only.
Read more at https://orkohunter.net/keep
Read more at https://github.com/orkohunter/keep
"""
ctx.verbose = verbose
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 33 additions & 33 deletions keep/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,39 +81,39 @@ def log(ctx, message):
ctx.log(message)


def push(ctx):
credentials_file = os.path.join(dir_path, '.credentials')
credentials = json.loads(open(credentials_file, 'r').read())
json_path = os.path.join(dir_path, 'commands.json')
credentials['commands'] = open(json_path).read()
url = api_url + '/push'
if click.confirm("This will overwrite the saved "
"commands on the server. Proceed?", default=True):
r = requests.post(url, json=credentials)
if r.status_code == 200:
click.echo("Server successfully updated.")


def pull(ctx, overwrite):
credentials_file = os.path.join(dir_path, '.credentials')
credentials = json.loads(open(credentials_file, 'r').read())
json_path = os.path.join(dir_path, 'commands.json')
url = api_url + '/pull'

r = requests.post(url, json=credentials)
if r.status_code == 200:
commands = json.loads(r.json()['commands'])

if not overwrite:
my_commands = read_commands()
commands.update(my_commands)

if not overwrite or (
overwrite and click.confirm(
"This will overwrite the locally saved commands. Proceed?", default=True)):
with open(json_path, 'w') as f:
f.write(json.dumps(commands))
click.echo("Local database successfully updated.")
# def push(ctx):
# credentials_file = os.path.join(dir_path, '.credentials')
# credentials = json.loads(open(credentials_file, 'r').read())
# json_path = os.path.join(dir_path, 'commands.json')
# credentials['commands'] = open(json_path).read()
# url = api_url + '/push'
# if click.confirm("This will overwrite the saved "
# "commands on the server. Proceed?", default=True):
# r = requests.post(url, json=credentials)
# if r.status_code == 200:
# click.echo("Server successfully updated.")


# def pull(ctx, overwrite):
# credentials_file = os.path.join(dir_path, '.credentials')
# credentials = json.loads(open(credentials_file, 'r').read())
# json_path = os.path.join(dir_path, 'commands.json')
# url = api_url + '/pull'

# r = requests.post(url, json=credentials)
# if r.status_code == 200:
# commands = json.loads(r.json()['commands'])

# if not overwrite:
# my_commands = read_commands()
# commands.update(my_commands)

# if not overwrite or (
# overwrite and click.confirm(
# "This will overwrite the locally saved commands. Proceed?", default=True)):
# with open(json_path, 'w') as f:
# f.write(json.dumps(commands))
# click.echo("Local database successfully updated.")


# def register():
Expand Down
7 changes: 4 additions & 3 deletions release.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
python setup.py bdist_wheel upload
python3 setup.py bdist_wheel upload
python setup.py sdist upload
rm -rf build/*
rm -rf dist/*
python3 setup.py sdist bdist_wheel
twine upload dist/*

0 comments on commit db5ade2

Please sign in to comment.