mirror of
https://github.com/kennethreitz-archive/python-localtunnel.git
synced 2026-06-05 15:30:18 +00:00
cli coming together
This commit is contained in:
+16
-3
@@ -9,19 +9,24 @@ This module provides the command-line interface for Localtunnel.
|
||||
import sys
|
||||
|
||||
import clint
|
||||
from clint.arguments import _expand_path as expand_path
|
||||
|
||||
USAGE = """
|
||||
USAGE = '''
|
||||
Usage: localtunnel [options] <localport>
|
||||
-k, --key FILE upload a public key for authentication
|
||||
-h, --help show this help
|
||||
""".lstrip()
|
||||
'''.lstrip()
|
||||
|
||||
PORT_ERROR = 'Invalid port number.'
|
||||
|
||||
def display_usage():
|
||||
"""Displays localtunnel usage."""
|
||||
|
||||
print USAGE
|
||||
|
||||
def display_port_error():
|
||||
print PORT_ERROR
|
||||
|
||||
|
||||
def main():
|
||||
"""Main localtunnel dispatch."""
|
||||
|
||||
@@ -31,6 +36,8 @@ def main():
|
||||
|
||||
elif ('-k', '--key') in clint.args:
|
||||
print 'importing key'
|
||||
# print clint.args.files
|
||||
print expand_path('~/ssh/*.pub')
|
||||
sys.exit()
|
||||
|
||||
elif not len(clint.args.not_flags):
|
||||
@@ -39,5 +46,11 @@ def main():
|
||||
|
||||
port = clint.args.not_flags.pop(0)
|
||||
|
||||
try:
|
||||
int(port)
|
||||
except ValueError:
|
||||
display_port_error()
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user