Skip to content

Commit

Permalink
diff_strings prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
bbkane committed Feb 11, 2025
1 parent 1a03af2 commit a2f32d5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions bin_common/bin_common/diff_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def get_edits_string(old, new):
Stolen from https://stackoverflow.com/questions/32500167/how-to-show-diff-of-two-string-sequences-in-colors
Examples:
{sys.argv[0]} # will prompt for strings
{sys.argv[0]} string1 string2
"""

Expand All @@ -60,11 +61,16 @@ def build_parser() -> argparse.ArgumentParser:


def main():

parser = build_parser()
args = parser.parse_args()

print(get_edits_string(args.string1, args.string2))
if len(sys.argv) == 1:
string1 = input("string1: ")
string2 = input("string2: ")
else:
parser = build_parser()
args = parser.parse_args()
string1 = args.string1
string2 = args.string2

print(get_edits_string(string1, string2))


if __name__ == "__main__":
Expand Down

0 comments on commit a2f32d5

Please sign in to comment.