Example #1
0
 def diff(args) -> str:
     """ Compare two diffenent string value for the given keys """
     output = ""
     if len(args.args) < 1:
         #todo the diff of all the keys between two files
         sys.exit(0)
     else:
         args.format = None
         string_1 = ConfCli.get(args)
         ConfCli._index = "string_diff"
         args.url = args.second_url
         ConfCli.init(args.url)
         string_2 = ConfCli.get(args)
         cmd = """bash -c "diff <(echo \\"%s\\") <(echo \\"%s\\")" """ % (
             string_1, string_2)
         cmd_proc = SimpleProcess([cmd])
         cmd_proc.shell = True
         stdout, stderr, rc = cmd_proc.run()
         output = stdout.decode('utf-8') if rc == 1 else \
             stderr.decode('utf-8')
     return output
Example #2
0
 def diff(args) -> str:
     """ Compare two diffenent string value for the given keys """
     if len(args.args) < 1:
         args.key_index = None
         string_1 = ConfCli.get_keys(args)
         diff_index = "string_diff"
         args.url = args.second_url
         ConfCli.load(args.url, diff_index)
         string_2 = ConfCli.get_keys(args, diff_index)
     else:
         string_1 = ConfCli.get(args)
         ConfCli._index = "string_diff"
         args.url = args.second_url
         ConfCli.init(args.url)
         string_2 = ConfCli.get(args)
     args.format = None
     cmd = """bash -c "diff <(echo \\"%s\\") <(echo \\"%s\\")" """ %(string_1, string_2)
     cmd_proc = SimpleProcess([cmd])
     cmd_proc.shell = True
     stdout, stderr, rc = cmd_proc.run()
     output = stdout.decode('utf-8') if rc == 1 else \
          stderr.decode('utf-8')
     return output