Skip to content

Commit

Permalink
[pre-commit.ci lite] apply automatic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci-lite[bot] authored Sep 8, 2024
1 parent 3cc424d commit 6cb7380
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"shiftleft-core.slHomePath": "/Users/evan/.shiftleft",
"restructuredtext.pythonRecommendation.disabled": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
// "shutdownAction": "none",
// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "cat .devcontainer/bashrc.override.sh >> ~/.bashrc"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"default": true,
"MD003": { "style": "atx" },
"blanks-around-headings": false
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{}
{}
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ brew "imagemagick"
# # PHP
# #------------------------------------------------------------------------------
# brew "php"
# cask "hook"
# cask "hook"
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ This License shall be governed by and construed in accordance with the laws of {

This License constitutes the entire agreement between you and Licensor regarding the use of the Software and supersedes all prior agreements, whether written or oral, relating to its subject matter.

{% endif %}
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ test-all: build

# run a specific test
test TEST: build
./test --test someVar
./test --test someVar
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

#==============================================================================
# ==============================================================================
# pythonScriptTemplate.py
#==============================================================================
# ==============================================================================
# Template to create new python cli scripts.
# Author: Evan Harmon
# Usage: python script.py --input input.txt --output output.txt --verbose
Expand All @@ -17,101 +17,102 @@
# Configure logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[logging.StreamHandler()]
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
handlers=[logging.StreamHandler()],
)

logger = logging.getLogger(__name__)


def parse_args():
"""
Parse command line arguments.
"""
parser = argparse.ArgumentParser(
description="A Python CLI script",
epilog="Example: python script.py --input file.txt"
epilog="Example: python script.py --input file.txt",
)

# Define arguments
parser.add_argument(
'-i', '--input',
type=str,
required=True,
help='Path to the input file'
"-i", "--input", type=str, required=True, help="Path to the input file"
)

parser.add_argument(
'-o', '--output',
type=str,
default='output.txt',
help='Path to the output file (default: output.txt)'
"-o",
"--output",
type=str,
default="output.txt",
help="Path to the output file (default: output.txt)",
)

parser.add_argument(
'-v', '--verbose',
action='store_true',
help='Enable verbose mode'
"-v", "--verbose", action="store_true", help="Enable verbose mode"
)

parser.add_argument(
'--version',
action='version',
version=f'%(prog)s {__version__}',
help='Show the script version and exit'
"--version",
action="version",
version=f"%(prog)s {__version__}",
help="Show the script version and exit",
)

return parser.parse_args()


def validate_args(args):
"""
Validate command line arguments.
"""
# Example validation: check if the input file exists
if not args.input.endswith('.txt'):
if not args.input.endswith(".txt"):
logger.error("Invalid input file. Must be a .txt file.")
sys.exit(1)

logger.info(f"Using input file: {args.input}")
logger.info(f"Output will be saved to: {args.output}")


def process_file(input_path, output_path):
"""
Placeholder for the main file processing logic.
"""
try:
with open(input_path, 'r') as infile:
with open(input_path, "r") as infile:
content = infile.read()

# Example processing: just write the content to the output file
with open(output_path, 'w') as outfile:
with open(output_path, "w") as outfile:
outfile.write(content)

logger.info(f"File processed successfully. Output saved to {output_path}")

except FileNotFoundError:
logger.error(f"File {input_path} not found.")
sys.exit(1)
except Exception as e:
logger.error(f"An error occurred: {str(e)}")
sys.exit(1)


def main():
"""
Main entry point of the script.
"""
args = parse_args()

# Enable verbose mode if requested
if args.verbose:
logger.setLevel(logging.DEBUG)

logger.debug("Arguments parsed successfully.")

# Validate the arguments
validate_args(args)

# Process the file
process_file(args.input, args.output)


if __name__ == "__main__":
main()
main()
2 changes: 1 addition & 1 deletion os/git/.gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
autoSetupRemote = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
Expand Down
2 changes: 1 addition & 1 deletion os/mac/mackup/.mackup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ ssh
aws
ansible
kubectl
iterm2
iterm2
2 changes: 1 addition & 1 deletion os/shell/dotfiles/.functions
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ seqn() {
echo $((current + 1)) > "$SEQN_FILE"
fi
cat "$SEQN_FILE"
}
}

0 comments on commit 6cb7380

Please sign in to comment.