Skip to content

Commit 39a40dc

Browse files
committed
(feat) refactor
1 parent dd00a08 commit 39a40dc

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

src/config.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@
4444

4545
OPTIONS = [
4646
{
47-
'title' : 'Search Google Drive'
47+
'title' : 'Search Google Drive',
48+
'autocomplete' : None
4849
},
4950
{
50-
'title' : 'Type ">" for Settings'
51+
'title' : 'Type ">" for Settings',
52+
'autocomplete' : '> '
5153
}
5254
]
5355

src/drive_api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ def show_options(cls):
132132
"""Show options"""
133133

134134
for option in OPTIONS:
135-
wf.add_item(title=option['title'])
135+
wf.add_item(title=option['title'],
136+
autocomplete=option['autocomplete'])
136137
wf.send_feedback()
137138

138139
@classmethod

src/drive_launcher.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
wf = Workflow(update_settings=UPDATE_SETTINGS, help_url=HELP_URL)
99

1010
def main(wf):
11-
url = wf.args[0]
12-
if url == 'logout':
13-
Drive.revoke_tokens()
14-
return sys.stdout.write("logged out")
15-
elif url == 'login':
16-
return Drive.open_auth_page()
17-
elif url == 'clear':
18-
Drive.clear_cache()
19-
return sys.stdout.write("cache cleared")
20-
elif url.startswith('set'):
21-
length = int(url[3:])
22-
Drive.set_cache_length(length)
23-
return sys.stdout.write("cache set to %s seconds" % str(length))
11+
url = wf.args[0]
12+
if url == 'logout':
13+
Drive.revoke_tokens()
14+
return sys.stdout.write('logged out')
15+
elif url == 'login':
16+
return Drive.open_auth_page()
17+
elif url == 'clear':
18+
Drive.clear_cache()
19+
return sys.stdout.write('cache cleared')
20+
elif url.startswith('set'):
21+
length = int(url[3:])
22+
Drive.set_cache_length(length)
23+
return sys.stdout.write('cache set to %s seconds' % str(length))
2424

25-
Drive.open_page(url)
25+
Drive.open_page(url)
2626

2727
if __name__ == '__main__':
28-
sys.exit(wf.run(main))
28+
sys.exit(wf.run(main))

0 commit comments

Comments
 (0)