2021-03-27 05:58:13 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2021-04-08 14:57:31 -04:00
|
|
|
from ._version import __version__
|
|
|
|
|
2021-11-05 05:59:51 -04:00
|
|
|
import io
|
2021-04-08 10:29:43 -04:00
|
|
|
import argparse
|
2021-04-08 14:57:31 -04:00
|
|
|
import nomadnet
|
2021-04-08 10:29:43 -04:00
|
|
|
|
|
|
|
|
2022-05-18 10:33:28 -04:00
|
|
|
def program_setup(configdir, rnsconfigdir, daemon, console):
|
|
|
|
app = nomadnet.NomadNetworkApp(
|
|
|
|
configdir = configdir,
|
|
|
|
rnsconfigdir = rnsconfigdir,
|
|
|
|
daemon = daemon,
|
|
|
|
force_console = console,
|
|
|
|
)
|
2021-04-08 10:29:43 -04:00
|
|
|
|
2021-03-27 05:58:13 -04:00
|
|
|
def main():
|
2021-04-08 10:29:43 -04:00
|
|
|
try:
|
|
|
|
parser = argparse.ArgumentParser(description="Nomad Network Client")
|
|
|
|
parser.add_argument("--config", action="store", default=None, help="path to alternative Nomad Network config directory", type=str)
|
|
|
|
parser.add_argument("--rnsconfig", action="store", default=None, help="path to alternative Reticulum config directory", type=str)
|
2022-05-18 08:00:13 -04:00
|
|
|
parser.add_argument("-t", "--textui", action="store_true", default=False, help="run Nomad Network in text-UI mode")
|
2022-05-18 10:33:28 -04:00
|
|
|
parser.add_argument("-d", "--daemon", action="store_true", default=False, help="run Nomad Network in daemon mode")
|
|
|
|
parser.add_argument("-c", "--console", action="store_true", default=False, help="in daemon mode, log to console instead of file")
|
2021-04-08 10:29:43 -04:00
|
|
|
parser.add_argument("--version", action="version", version="Nomad Network Client {version}".format(version=__version__))
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
if args.config:
|
|
|
|
configarg = args.config
|
|
|
|
else:
|
|
|
|
configarg = None
|
|
|
|
|
|
|
|
if args.rnsconfig:
|
|
|
|
rnsconfigarg = args.rnsconfig
|
|
|
|
else:
|
|
|
|
rnsconfigarg = None
|
|
|
|
|
2022-05-18 10:33:28 -04:00
|
|
|
console = False
|
2022-05-18 08:00:13 -04:00
|
|
|
if args.daemon:
|
|
|
|
daemon = True
|
2022-05-18 10:33:28 -04:00
|
|
|
if args.console:
|
|
|
|
console = True
|
2022-05-18 08:00:13 -04:00
|
|
|
else:
|
|
|
|
daemon = False
|
|
|
|
|
|
|
|
if args.textui:
|
|
|
|
daemon = False
|
|
|
|
|
2022-05-18 10:33:28 -04:00
|
|
|
program_setup(configarg, rnsconfigarg, daemon, console)
|
2021-04-08 10:29:43 -04:00
|
|
|
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
print("")
|
|
|
|
exit()
|
2021-03-27 05:58:13 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2021-04-08 10:29:43 -04:00
|
|
|
main()
|