Skip to content

Commit

Permalink
Show help for all commands when no argument is given
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Oct 25, 2013
1 parent 846b60e commit b99a40a
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions orochi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ def show_next_page(self, s):
# Actual commands

def do_search(self, s):
mixes = self.search_request(s, 'keyword')
self.display_search_results(mixes, s)
if not s:
self.help_search()
else:
mixes = self.search_request(s, 'keyword')
self.display_search_results(mixes, s)

def help_search(self):
print('Syntax: search <searchterm>')
Expand All @@ -221,23 +224,29 @@ def help_search_tags(self):
print('Pressing <enter> shows next page results.')

def do_search_user(self, s):
try:
mixes = self.search_request(s, 'user')
self.display_search_results(mixes, s)
except HTTPError:
print('User %s not found.' % s)
if not s:
self.help_search_user()
else:
try:
mixes = self.search_request(s, 'user')
self.display_search_results(mixes, s)
except HTTPError:
print('User %s not found.' % s)

def help_search_user(self):
print('Syntax: search <username>')
print('Search for a mix by user. You can then play a mix with the "play" command.')
print('Pressing <enter> shows next page results.')

def do_search_user_liked(self, s):
try:
mixes = self.search_request(s, 'user_liked')
self.display_search_results(mixes, s)
except HTTPError:
print('User %s not found.' % s)
if not s:
self.help_search_user_liked()
else:
try:
mixes = self.search_request(s, 'user_liked')
self.display_search_results(mixes, s)
except HTTPError:
print('User %s not found.' % s)

def help_search_user_liked(self):
print('Syntax: search <username>')
Expand Down

0 comments on commit b99a40a

Please sign in to comment.