allow specification of username on the commandline
parent
5cfac74c95
commit
bbe7dc0d41
|
@ -35,24 +35,18 @@ import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# XxX_N0_4rgP4rs3_XxX ###yoloswag
|
# XxX_N0_4rgP4rs3_XxX ###yoloswag
|
||||||
|
def get_arg(key, default=None, get_value=True):
|
||||||
try:
|
try:
|
||||||
port_spec = argv.index("--port")
|
spec = argv.index("--" + key)
|
||||||
port = argv[port_spec+1]
|
value = argv[spec + 1] if get_value else True
|
||||||
except ValueError: # --port not specified
|
except ValueError: # --key not specified
|
||||||
port = 7099
|
value = default
|
||||||
except IndexError: # flag given but no value
|
except IndexError: # flag given but no value
|
||||||
exit("thats not how this works, silly! --port 7099")
|
exit("invalid format for --" + key)
|
||||||
|
return value
|
||||||
|
|
||||||
try:
|
try:
|
||||||
host_spec = argv.index("--host")
|
network = BBJ(get_arg("host", "127.0.0.1"), get_arg("port", 7099))
|
||||||
host = argv[host_spec+1]
|
|
||||||
except ValueError: # --host not specified
|
|
||||||
host = "127.0.0.1"
|
|
||||||
except IndexError: # flag given but no value
|
|
||||||
exit("thats not how this works, silly! --host 127.0.0.1")
|
|
||||||
|
|
||||||
try:
|
|
||||||
network = BBJ(host, port)
|
|
||||||
except URLError as e:
|
except URLError as e:
|
||||||
# print the connection error in red
|
# print the connection error in red
|
||||||
exit("\033[0;31m%s\033[0m" % repr(e))
|
exit("\033[0;31m%s\033[0m" % repr(e))
|
||||||
|
@ -1947,7 +1941,7 @@ def log_in():
|
||||||
chain. The user is run through this before starting the
|
chain. The user is run through this before starting the
|
||||||
curses app.
|
curses app.
|
||||||
"""
|
"""
|
||||||
name = sane_value("user_name", "Username", return_empty=True)
|
name = get_arg("user") or sane_value("user_name", "Username", return_empty=True)
|
||||||
if name == "":
|
if name == "":
|
||||||
motherfucking_rainbows("~~W3 4R3 4n0nYm0u5~~")
|
motherfucking_rainbows("~~W3 4R3 4n0nYm0u5~~")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue