8 Commits
0.0.2 ... 0.0.5

Author SHA1 Message Date
22972d578c Update version number to 0.0.5
- Changed version in `VERSION` file from `0.0.4` to `0.0.5`
- Note: No newline at end of file
2024-08-19 19:52:03 +02:00
a48f4638c0 Update git log command format
- Modified the `log_command` to use a more detailed pretty format
  - Changed to `--pretty="format:%h%n%ad%n%s%n%n%b%n---%n"`
2024-08-19 19:52:03 +02:00
b50de01653 Add .gitattributes file
- Created `.gitattributes` file
- Configured `* text=auto eol=lf` setting
2024-08-19 19:52:03 +02:00
888acd355f Update version number to 0.0.4
- Changed version in `VERSION` file from `0.0.3` to `0.0.4`
- Ensured no newline at end of file remains consistent
2024-08-19 19:11:25 +02:00
92b4d3872f Add fallback config file search feature
- Added a section on fallback configuration file search in `README.md`
- Explained searching for configuration files in the user's home directory under `~\.ait\*`
- Mentioned the option to provide a user-wide configuration file in the `~\.ait\` directory
2024-08-19 19:11:25 +02:00
b4702c1a72 Update config path resolution logic
- Modify `resolve_config_path` to check for `.json` files.
- First check in the current directory.
- Then check in `.ait` directory in the user's home directory.
- Return filename even if non-existent for later failure handling.
2024-08-19 19:11:25 +02:00
aec4c78c6a Update version number to 0.0.3
- Changed version in `VERSION` file from `0.0.2` to `0.0.3`
2024-08-19 18:51:01 +02:00
59ac01451f Add newline characters around generated text
- Added `\n` before and after `generated_text` in the print statement
2024-08-19 18:50:42 +02:00
4 changed files with 30 additions and 6 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto eol=lf

View File

@@ -60,6 +60,12 @@ python ait.py --config custom
This command will look for a configuration file named `ait.custom.config`.
### Fallback Configuration File search
As a fallback, if no configuration file is found, the script will search for it in the user's home directory under `~\.ait\*`.
You can also provide a user wide configuration file by placing it in the `~\.ait\` directory.
### Command-Line Options
- `--config`: Path to a JSON config file or a keyword to identify a specific config (`ait.<KEYWORD>.config`). Default is `ait.config.json`.

View File

@@ -1 +1 @@
0.0.2
0.0.5

27
ait.py
View File

@@ -22,7 +22,8 @@ def load_config(config_path):
def resolve_config_path(config_input):
"""
Resolves the configuration file path. If a single word is provided,
it looks for a file named 'ait.WORD.config' in the current directory.
it looks for a file named 'ait.WORD.config.json' in the current directory first,
then in a '.ait' directory in the user's home directory.
Parameters:
- config_input (str): The input provided via the command-line argument.
@@ -30,9 +31,24 @@ def resolve_config_path(config_input):
Returns:
- str: The resolved path to the configuration file.
"""
# If it's a keyword, construct the potential filenames
if not config_input.endswith(".json"):
config_input = f"ait.{config_input}.config.json"
return config_input
config_filename = f"ait.{config_input}.config.json"
else:
config_filename = config_input
# Check in the current directory
if os.path.exists(config_filename):
return config_filename
# Check in the user's home directory under .ait/
home_directory = os.path.expanduser("~")
user_config_path = os.path.join(home_directory, ".ait", config_filename)
if os.path.exists(user_config_path):
return user_config_path
# If nothing found, return the filename (it will fail later if non-existent)
return config_filename
def run_git_commands(diff_expression, log_expression):
"""
@@ -48,7 +64,7 @@ def run_git_commands(diff_expression, log_expression):
diff_command = ["git", "diff", diff_expression]
diff_result = subprocess.run(diff_command, capture_output=True, text=True)
log_command = ["git", "log", log_expression, "--pretty=format:%h %s%n%b%n---%n"]
log_command = ["git", "log", log_expression, "--pretty=\"format:%h%n%ad%n%s%n%n%b%n---%n\""]
log_result = subprocess.run(log_command, capture_output=True, text=True)
return diff_result.stdout, log_result.stdout
@@ -146,4 +162,5 @@ if __name__ == "__main__":
)
# Output the generated text
print(generated_text)
print("\n" + generated_text + "\n")