Loading cccli/command.py +12 −7 Original line number Diff line number Diff line Loading @@ -197,6 +197,15 @@ class RemoteCommand(OptionCommand): def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) # ignore tag option self.add_option("-I", "--ignore-tag", action="append", dest="ignore", default=[], help="Don't display a tag in objects") # no print count at end option self.add_option("--no-count", action="store_true", dest="nocount", help="Don't print count at end of objects") # index printing self.add_option("-i", "--index", action="store_true", dest="index", help="Print object lines indexed") self.rpc = cli.rpc def remote_functions(self): Loading @@ -213,6 +222,8 @@ class RemoteCommand(OptionCommand): if self.options.index: self.printer.out("[%s] "%i, nl="") self.print_tags(o, order=_order) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objectlist["objects"])) def print_tags(self, taglist, order=None): '''Display a tag with tagdisplay settings''' Loading Loading @@ -252,14 +263,9 @@ class TqlCommand(RemoteCommand): # set tql status stuff self.add_option("-q", "--quiet", action="store_false", dest="status", help="Dont status of call request") # index printing self.add_option("-i", "--index", action="store_true", dest="index", help="Print TQL line index") # tql printer option self.add_option("--print-tql", action="store_true", dest="tql_print", help="Print TQL before sending to server") self.add_option("-I", "--ignore-tag", action="append", dest="ignore", default=[], help="Don't display a tag") # set tagdisplay stuff self.tdr = self.cli.tagdisplay.resolve self.tdc = self.cli.tagdisplay.color Loading Loading @@ -372,7 +378,6 @@ class TqlCommand(RemoteCommand): raise cmdError("No selected object by TQL.") self.printer.out("Objects:") self.print_objects(objs) self.printer.out("Objects count: %s"%len(objs["objects"])) # be sure boby want do that if self.printer.ask("%sProceed?%s (yes): "%(color["lred"], color["reset"])) != "yes": raise cmdWarning("User aborted") Loading cccli/commands/list.py +9 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,9 @@ class Command_list(TqlCommand): tmp_pos += 1 new_line = not found_pos and not first_line self.printer.out("%s%s"%(line, color["reset"])) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_table(self, objs): '''Listing table style''' Loading Loading @@ -175,6 +178,8 @@ class Command_list(TqlCommand): self.printer.out(buf, nl="") self.printer.out(color["reset"]) order = order[tag_index:] if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_vertical(self, objs): '''Vertical display''' Loading Loading @@ -217,6 +222,8 @@ class Command_list(TqlCommand): else: line += (buf[:-(margin + 1)] + os.linesep) self.printer.out("%s%s"%(line[:-1], color["reset"])) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_mikrotik(self, objs): '''Mikrotik style display''' Loading Loading @@ -281,6 +288,8 @@ class Command_list(TqlCommand): buf, line_pos = self._format_indent_text(self.tdr(tag, o.get(tag)) + " ", line_pos, margin, term_width) line += self.tdc(tag) + buf self.printer.out("%s%s%s"%(line, color["reset"], os.linesep)) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def _format_indent_text(self, text, current_pos, min_pos, max_pos): '''Reformat text to start in current_pos and fit in column between min_pos and max_pos Loading Loading
cccli/command.py +12 −7 Original line number Diff line number Diff line Loading @@ -197,6 +197,15 @@ class RemoteCommand(OptionCommand): def __init__(self, cli, argv0): OptionCommand.__init__(self, cli, argv0) # ignore tag option self.add_option("-I", "--ignore-tag", action="append", dest="ignore", default=[], help="Don't display a tag in objects") # no print count at end option self.add_option("--no-count", action="store_true", dest="nocount", help="Don't print count at end of objects") # index printing self.add_option("-i", "--index", action="store_true", dest="index", help="Print object lines indexed") self.rpc = cli.rpc def remote_functions(self): Loading @@ -213,6 +222,8 @@ class RemoteCommand(OptionCommand): if self.options.index: self.printer.out("[%s] "%i, nl="") self.print_tags(o, order=_order) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objectlist["objects"])) def print_tags(self, taglist, order=None): '''Display a tag with tagdisplay settings''' Loading Loading @@ -252,14 +263,9 @@ class TqlCommand(RemoteCommand): # set tql status stuff self.add_option("-q", "--quiet", action="store_false", dest="status", help="Dont status of call request") # index printing self.add_option("-i", "--index", action="store_true", dest="index", help="Print TQL line index") # tql printer option self.add_option("--print-tql", action="store_true", dest="tql_print", help="Print TQL before sending to server") self.add_option("-I", "--ignore-tag", action="append", dest="ignore", default=[], help="Don't display a tag") # set tagdisplay stuff self.tdr = self.cli.tagdisplay.resolve self.tdc = self.cli.tagdisplay.color Loading Loading @@ -372,7 +378,6 @@ class TqlCommand(RemoteCommand): raise cmdError("No selected object by TQL.") self.printer.out("Objects:") self.print_objects(objs) self.printer.out("Objects count: %s"%len(objs["objects"])) # be sure boby want do that if self.printer.ask("%sProceed?%s (yes): "%(color["lred"], color["reset"])) != "yes": raise cmdWarning("User aborted") Loading
cccli/commands/list.py +9 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,9 @@ class Command_list(TqlCommand): tmp_pos += 1 new_line = not found_pos and not first_line self.printer.out("%s%s"%(line, color["reset"])) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_table(self, objs): '''Listing table style''' Loading Loading @@ -175,6 +178,8 @@ class Command_list(TqlCommand): self.printer.out(buf, nl="") self.printer.out(color["reset"]) order = order[tag_index:] if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_vertical(self, objs): '''Vertical display''' Loading Loading @@ -217,6 +222,8 @@ class Command_list(TqlCommand): else: line += (buf[:-(margin + 1)] + os.linesep) self.printer.out("%s%s"%(line[:-1], color["reset"])) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def list_mikrotik(self, objs): '''Mikrotik style display''' Loading Loading @@ -281,6 +288,8 @@ class Command_list(TqlCommand): buf, line_pos = self._format_indent_text(self.tdr(tag, o.get(tag)) + " ", line_pos, margin, term_width) line += self.tdc(tag) + buf self.printer.out("%s%s%s"%(line, color["reset"], os.linesep)) if not self.options.nocount: self.printer.out("Objects count: %s" % len(objs["objects"])) def _format_indent_text(self, text, current_pos, min_pos, max_pos): '''Reformat text to start in current_pos and fit in column between min_pos and max_pos Loading