diff --git a/src/sshare/cli.py b/src/sshare/cli.py index 135a263..87af8be 100644 --- a/src/sshare/cli.py +++ b/src/sshare/cli.py @@ -71,6 +71,23 @@ class Config: with open(config_path, mode="rb") as file: return tomllib.load(file) + +def rebase(number): + if number == 0: + return "0" + rebased = "" + while number != 0: + digit = number % 62 + if digit < 10: + rebased = chr(digit + 48) + rebased + elif digit < 36: + rebased = chr(digit + 87) + rebased + else: + rebased = chr(digit + 29) + rebased + number = int(number / 62) + return rebased + + def main(): arguments = parse_arguments() @@ -101,7 +118,7 @@ def main(): print("Error: must specify one of -f FILE, -l, -p") sys.exit(1) - target_id = time.time_ns() + target_id = rebase(time.time_ns()) target_file_name = f"{target_id}{target_file_extension}" target_file = f"{config.ssh_path}/{target_file_name}" target_destination = f"{config.ssh_user}@{config.host_name}"