Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Handle comments and introduce a parser #2

Closed
wants to merge 115 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
115 commits
Select commit Hold shift + click to select a range
18bbb36
feat: Add source file for parsing functionality
schpet Sep 14, 2024
36fa7b0
aider: feat: Implement a parser that preserves comments and empty lines
schpet Sep 14, 2024
582c309
aider: style: Simplify return statement in split_value_and_comment fu…
schpet Sep 14, 2024
cd9a775
aider: feat: add command to print AST as JSON
schpet Sep 14, 2024
7e17f42
aider: feat: add dependencies to Cargo.toml
schpet Sep 14, 2024
a261548
refactor: Reorganize imports in main.rs
schpet Sep 14, 2024
648a7a4
aider: fix: Export `parse` module in `lib.rs` and update import in `m…
schpet Sep 14, 2024
28c3099
aider: fix: Add Deserialize derive to Node and Ast structs
schpet Sep 14, 2024
3393da9
aider: style: sort imports alphabetically
schpet Sep 14, 2024
e5e4c24
feat: Add serde and serde_json dependencies
schpet Sep 14, 2024
5783eca
aider: fix: Enable serde derive feature in Cargo.toml
schpet Sep 14, 2024
0392f0b
aider: fix: Update parsing of key-value pairs and comments
schpet Sep 14, 2024
02041e2
aider: fix: Update split_value_and_comment function to correctly hand…
schpet Sep 14, 2024
a53758f
aider: fix: Update split_value_and_comment function to correctly hand…
schpet Sep 14, 2024
484f08b
schpet Sep 14, 2024
f37e16c
aider: refactor: rewrite parse_key_value to behave more similarly to …
schpet Sep 14, 2024
0817536
aider: fix: Update parse_key_value function to handle comments and wh…
schpet Sep 14, 2024
bfe8231
aider: feat: add tests for parsing various line formats
schpet Sep 14, 2024
2c0d241
aider: fix: Update parse_key_value function to handle "export" prefix…
schpet Sep 14, 2024
73b528f
aider: feat: replace the parsing in src/lib.rs with the parser
schpet Sep 14, 2024
0568b62
aider: chore: Run the linter
schpet Sep 14, 2024
e117788
fix: Remove unnecessary whitespace from configuration values
schpet Sep 14, 2024
77e8695
aider: feat: Replace old parsing logic with new AST-based parser
schpet Sep 14, 2024
04ee386
aider: fix: Fix failing tests in `delete_env_vars` and `write_env_file`
schpet Sep 14, 2024
0ed3e38
aider: fix: Maintain consistent order when writing environment variab…
schpet Sep 14, 2024
b5cbec1
schpet Sep 14, 2024
0747679
aider: refactor: rewrite write_env_file to use the ast from parse
schpet Sep 14, 2024
c5e98ed
aider: chore: Run the linter
schpet Sep 14, 2024
1dd45e5
aider: feat: add test case for writing environment variables with quotes
schpet Sep 14, 2024
91f8c46
aider: feat: Implement quoting for environment variable values
schpet Sep 14, 2024
8827008
test: Add test for writing environment variables with quotes
schpet Sep 14, 2024
8c83551
aider: feat: add debug logging to test_write_vars_with_quotes
schpet Sep 14, 2024
45c857f
aider: style: Run the linter
schpet Sep 14, 2024
3c6a6de
aider: feat: add debug print for environment variables in test_write_…
schpet Sep 14, 2024
6a3a162
aider: feat: add debug print statement for file contents in test_writ…
schpet Sep 14, 2024
6369c96
fix: Remove unnecessary assertions in test_write_vars_with_quotes
schpet Sep 14, 2024
2bf6f02
aider: fix: Handle quoting of environment variable values with both s…
schpet Sep 14, 2024
3c03b83
aider: fix: Handle backslash escaping in quote_value function
schpet Sep 14, 2024
dfc6798
aider: feat: add print statement to output file contents in test_writ…
schpet Sep 14, 2024
57faf72
aider: fix: Handle quotes in environment variable values
schpet Sep 14, 2024
463f53b
aider: style: format code
schpet Sep 14, 2024
20f2abb
aider: fix: Fix quoting of environment variables with single and doub…
schpet Sep 14, 2024
28d59b2
aider: fix: Improve handling of single and double quotes in `quote_va…
schpet Sep 14, 2024
80f7b6c
aider: fix: Implement correct quoting behavior for quote_value function
schpet Sep 14, 2024
4561ff0
fix: Update test cases for writing variables with quotes
schpet Sep 14, 2024
f47743d
fix: Remove unnecessary commented-out assertions in test_write_vars_w…
schpet Sep 14, 2024
c27bb49
aider: feat: add test for parsing quoted values through args
schpet Sep 14, 2024
896f1bd
aider: feat: add test for setting quoted values through args
schpet Sep 14, 2024
b933962
aider: style: format code with rustfmt
schpet Sep 14, 2024
e12dbfe
aider: fix: Remove single quotes from quoted values
schpet Sep 14, 2024
ed66d6c
aider: fix: ensure no empty keys are written to .env file
schpet Sep 14, 2024
d634995
aider: feat: add test for parse_args preserving single quotes
schpet Sep 14, 2024
3c337bb
aider: style: Simplify test_parse_args_preserves_single_quotes
schpet Sep 14, 2024
769c8ed
fix: Print all parsed arguments for debugging
schpet Sep 14, 2024
620d2f1
aider: fix: preserve single quotes in parse_args
schpet Sep 14, 2024
b377f6d
aider: style: Fix formatting in parse.rs
schpet Sep 14, 2024
05f0cb5
aider: fix: Update parse_key_value function to correctly handle singl…
schpet Sep 14, 2024
7d97ee1
aider: fix: Update parse_key_value function in src/parse.rs
schpet Sep 14, 2024
076430c
aider: fix: Preserve single quotes in parsed arguments
schpet Sep 14, 2024
19a7c46
feat: Add support for single quotes in parse_args
schpet Sep 14, 2024
a91795d
aider: fix: remove surrounding single quotes from parsed arguments
schpet Sep 14, 2024
62e9fa6
aider: style: format code in tests.rs
schpet Sep 14, 2024
eb21dc9
aider: fix: Fix issue with parse_args removing trailing quotes
schpet Sep 14, 2024
e9ed5a1
aider: style: Ran the linter
schpet Sep 14, 2024
90c3077
schpet Sep 15, 2024
0fc5b6c
schpet Sep 15, 2024
8ed04a9
schpet Sep 15, 2024
38260aa
don't sort
schpet Sep 15, 2024
b2009a6
aider: fix: Update existing variables in place when writing env file
schpet Sep 15, 2024
3132e40
aider: fix: Maintain original order of keys when writing env file
schpet Sep 15, 2024
5d2b899
aider: fix: Maintain original order of environment variables in write…
schpet Sep 15, 2024
ae3a5f8
aider: feat: Enhance print_all_env_vars_to_writer to show quoted valu…
schpet Sep 15, 2024
0693a26
aider: style: format code
schpet Sep 15, 2024
0559b6e
aider: fix: Update print_all_env_vars_to_writer function to handle em…
schpet Sep 15, 2024
c6f10ec
aider: fix: Update print_all_env_vars_to_writer function in src/lib.rs
schpet Sep 15, 2024
ae8b274
aider: style: Format code with consistent indentation
schpet Sep 15, 2024
d4e14f1
aider: fix: Sort environment variables alphabetically when printing all
schpet Sep 15, 2024
8d37e7b
aider: test: add test ensuring print prints trailing commas
schpet Sep 15, 2024
d79ff72
feat: add debug logging and print new environment variables
schpet Sep 15, 2024
5d54a8b
aider: refactor: print_all_env_vars_to_writer uses AST directly
schpet Sep 15, 2024
bc7b7a2
fix: Improve test for print_all_env_vars function
schpet Sep 15, 2024
a8c0857
aider: fix: Convert Vec<u8> to String before using unwrap()
schpet Sep 15, 2024
b4ded3c
aider: style: Improve code formatting in tests.rs
schpet Sep 15, 2024
3a3765e
aider: fix: Handle errors when stripping ANSI escapes
schpet Sep 15, 2024
9b15195
aider: style: Format code with rustfmt
schpet Sep 15, 2024
615eb29
fix: Remove unnecessary code in test_print_all_env_vars
schpet Sep 15, 2024
5d6aee0
aider: feat: implement the todo in tests
schpet Sep 15, 2024
e54835f
aider: style: Format code with rustfmt
schpet Sep 15, 2024
36d6839
aider: fix: replace `unwrap_or_else` with `map_err` in `src/tests.rs`
schpet Sep 15, 2024
f58ab06
schpet Sep 15, 2024
c298575
aider: refactor: Use AST directly in delete_env_vars function
schpet Sep 15, 2024
7492619
aider: fix: Update `Node` enum to implement `Clone` trait
schpet Sep 15, 2024
0eba22d
aider: fix: Remove trailing newline from deleted environment variables
schpet Sep 15, 2024
6ff9633
aider: style: Run linter and format code
schpet Sep 15, 2024
c266d05
aider: fix: ensure delete_env_vars always has a trailing newline
schpet Sep 15, 2024
e5bbf83
schpet Sep 15, 2024
76259c6
aider: refactor: Refactor read_env_file to only return the hashmap of…
schpet Sep 15, 2024
f197105
aider: chore: Run the linter
schpet Sep 15, 2024
570a23a
aider: refactor: Update `print_all_keys_to_writer` function to use th…
schpet Sep 15, 2024
f642401
aider: fix: update read_env_file usage in tests and main
schpet Sep 15, 2024
b3e47bd
aider: fix: Update tests to work with new read_env_file signature
schpet Sep 15, 2024
5bf7e3a
aider: fix: Update test cases to match new function signatures
schpet Sep 15, 2024
7793611
aider: fix: Update test cases to match new function signatures
schpet Sep 15, 2024
41d93d7
schpet Sep 15, 2024
1a725f0
schpet Sep 15, 2024
c7cf70e
aider: feat: add test to preserve comments when setting new env var
schpet Sep 15, 2024
6f1e26e
aider: style: Format code with rustfmt
schpet Sep 15, 2024
68b2266
aider: fix: preserve comments when setting new environment variables
schpet Sep 15, 2024
3c79eb0
aider: style: Ran the linter
schpet Sep 15, 2024
0d1c754
fix: Preserve comments when setting new variables
schpet Sep 15, 2024
f8a5cdb
aider: fix: Preserve comments when setting new environment variables
schpet Sep 15, 2024
24474d5
comment out test
schpet Sep 16, 2024
4375d41
aider: feat: Modify write_env_file to update AST and create write_ast…
schpet Sep 16, 2024
9b02f85
order of insertion
schpet Sep 16, 2024
9c472e7
schpet Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 88 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ path = "src/main.rs"
clap = { version = "4.5.17", features = ["derive"] }
colored = "2.0"
atty = "0.2"
serde_json = "1.0.128"
serde = { version = "1.0.210", features = ["derive"] }

[dev-dependencies]
strip-ansi-escapes = "0.2.0"
tempfile = "3.2"
Loading
Loading