This commit is contained in:
2024-12-14 13:22:01 -06:00
parent aef6932eac
commit baa1a3c66e
2 changed files with 15 additions and 1 deletions

View File

@@ -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

View File

@@ -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()