diff options
| author | 2018-11-13 10:40:49 +0000 | |
|---|---|---|
| committer | 2018-11-13 10:40:49 +0000 | |
| commit | 73c0c911d4aaeb4cf7eac5bb81fac65797ebf062 (patch) | |
| tree | 5f6a5a4f4515259dab76d1f1a75fd900e3b7077d /src/utils/cli.py | |
| parent | Add "prefixed-commands" to !channelset (diff) | |
| signature | ||
Move logic for adding a server to the database out to utils.cli and add a
--add-server flag for start.py, to add new server
Diffstat (limited to 'src/utils/cli.py')
| -rw-r--r-- | src/utils/cli.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utils/cli.py b/src/utils/cli.py new file mode 100644 index 00000000..98d6be92 --- /dev/null +++ b/src/utils/cli.py @@ -0,0 +1,19 @@ +from src import Database + +def bool_input(s: str): + result = input("%s (Y/n): " % s) + return not result or result[0].lower() in ["", "y"] + +def add_server(database: Database.Database): + alias = input("alias: ") + hostname = input("hostname: ") + port = int(input("port: ")) + tls = bool_input("tls?") + password = input("password?: ") + ipv4 = bool_input("ipv4?") + nickname = input("nickname: ") + username = input("username: ") + realname = input("realname: ") + bindhost = input("bindhost?: ") + database.servers.add(alias, hostname, port, password, ipv4, tls, bindhost, nickname, username, realname) + |
