'url n' prints URL of item n
This commit is contained in:
parent
265a69a6ed
commit
33a0765011
21
av98.py
21
av98.py
|
@ -1480,8 +1480,25 @@ Use 'ls -l' to see URLs."""
|
|||
|
||||
@needs_gi
|
||||
def do_url(self, *args):
|
||||
"""Print URL of most recently visited item."""
|
||||
print(self.gi.url)
|
||||
"""Print the URL of an item.
|
||||
'url' prints the URL of the most recently visited item.
|
||||
'url n' prints the URL of item n."""
|
||||
# If no argument print current URL
|
||||
if args[0] == '':
|
||||
print(self.gi.url)
|
||||
return
|
||||
# If there is a valid integer argument print url of that item.
|
||||
try:
|
||||
n = int(args[0])
|
||||
except ValueError:
|
||||
print("Invalid item number.")
|
||||
return
|
||||
try:
|
||||
gi = self.lookup[n-1]
|
||||
except IndexError:
|
||||
print ("Index too high!")
|
||||
return
|
||||
print(gi.url)
|
||||
|
||||
### Bookmarking stuff
|
||||
@restricted
|
||||
|
|
Loading…
Reference in New Issue