From d4f609132f7e4111dcf1d51dfb3f9ed2f6ffd239 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Fri, 21 Apr 2023 23:54:22 +0200 Subject: host-control: Rename sell mode to non-interactive mode Signed-off-by: Paul Kocialkowski --- host-control | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/host-control b/host-control index 58f311d..8ed59ff 100755 --- a/host-control +++ b/host-control @@ -12,14 +12,14 @@ data_path_base = ".config/host-control.yaml" class host_control(): host = None verbose = False - shell = False + interactive = True usage = "Usage: host-control [options] [action]\n" \ "\n" \ "Options:\n" \ " -h [host]: specify host\n" \ " -v: tell more details\n" \ - " -s: produce minimal shell output\n" \ + " -n: non-interactive mode\n" \ "\n" \ "Actions:\n" \ " system-info show kernel info\n" \ @@ -48,7 +48,7 @@ class host_control(): # utils def print_message(self, message): - if not self.shell: + if self.interactive: print(message) def print_command(self, command): @@ -213,8 +213,7 @@ class host_control(): if config is None: return 1 - if not self.shell: - self.print_message("Updating host " + self.host + " config: " + name) + self.print_message("Updating host " + self.host + " config: " + name) for f in config["files"]: source = f.split(":")[0] @@ -235,8 +234,7 @@ class host_control(): if config is None: return 1 - if not self.shell: - self.print_message("Import host " + self.host + " config: " + name) + self.print_message("Import host " + self.host + " config: " + name) for f in config["files"]: source = f.split(":")[0] @@ -249,8 +247,7 @@ class host_control(): if config is None: return 1 - if not self.shell: - self.print_message("Diff host " + self.host + " config: " + name) + self.print_message("Diff host " + self.host + " config: " + name) for f in config["files"]: source = f.split(":")[0] @@ -271,7 +268,7 @@ class host_control(): elif not "files" in c: continue - if not self.shell: + if self.interactive: print("- " + c["name"]) else: print(c["name"]) @@ -400,7 +397,7 @@ class host_control(): if not "name" in u: continue - if not self.shell: + if self.interactive: print("- " + u["name"]) else: print(u["name"]) @@ -463,7 +460,7 @@ class host_control(): self.host_call(host, command) - # main + # host-control def data_load(self): if "SUDO_USER" in os.environ: @@ -497,8 +494,8 @@ class host_control(): self.host = value elif key == "-v": self.verbose = True - elif key == "-s": - self.shell = True + elif key == "-n": + self.interactive = False if len(arguments) < 1: self.print_message(self.usage) -- cgit v1.2.3