From baa1a3c66e0a79234904eaaddda7357af8383aa0 Mon Sep 17 00:00:00 2001 From: Steven Crawford Date: Sat, 14 Dec 2024 13:22:01 -0600 Subject: [PATCH] updates --- README.md | 4 ++++ install_scripts.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b4e26f6..c67ffcc 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,10 @@ Then, cd into the directory and run the following command: ```bash python3 install_scripts.py ``` +If updating scripts (and have already added ~/bin/ to the system PATH) run with the --upgrade parameter: +```bash +python3 install_scripts.py --upgrade +``` ## Usage diff --git a/install_scripts.py b/install_scripts.py index c576d38..2aba2bf 100644 --- a/install_scripts.py +++ b/install_scripts.py @@ -1,6 +1,7 @@ import os import shutil import sys +import argparse def find_files_starting_with(prefix): # Get the list of all files and directories in the current working directory @@ -60,6 +61,14 @@ def main(): # Define the prefix prefix = "cmg-" + # Create an argument parser object + parser = argparse.ArgumentParser(description='Check for a specific flag.') + # Add a flag argument to the parser + parser.add_argument('-u', '--upgrade', action="store_true", help='Specify to not copy ~/bin/ to PATH') + + # Parse the command-line arguments + args = parser.parse_args() + # Find all files starting with the given prefix source_files = find_files_starting_with(prefix) # source_files = ['cmg-get-drive-link.py', 'cmg-split-zip-smaller-chunks.py'] # Add your script names here @@ -78,7 +87,8 @@ def main(): copy_files_to_bin(source_files, bin_path) # Ensure bin is in the system path - ensure_bin_in_path(bin_path) + if not args.upgrade: + ensure_bin_in_path(bin_path) if __name__ == "__main__": main()