diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2026-02-01 20:38:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-01 20:38:09 +0100 |
| commit | 2d860c98337471d14d068089796b8c4ccede9405 (patch) | |
| tree | 3352f9f0a0b55fc4c116940829087e5a91ce2a01 /tools | |
| parent | e00ab8c20f10eea7974cc2bfabbb4c3bff20d8d8 (diff) | |
| parent | c542aa57c87c805f53bba89a1018861194f07127 (diff) | |
Merge pull request #1252 from gxhamster/custom-config-path
Feat: Add support for odinfmt custom config path
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/odinfmt/main.odin | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin index f0ab79b..b44af5c 100644 --- a/tools/odinfmt/main.odin +++ b/tools/odinfmt/main.odin @@ -18,6 +18,7 @@ Args :: struct { write: bool `args:"name=w" usage:"write the new format to file"`, stdin: bool `usage:"formats code from standard input"`, path: string `args:"pos=0" usage:"set the file or directory to format"`, + config: string `usage:"path to a config file"` } format_file :: proc(filepath: string, config: printer.Config, allocator := context.allocator) -> (string, bool) { @@ -73,7 +74,12 @@ main :: proc() { watermark : uint = 0 - config := format.find_config_file_or_default(args.path) + config: printer.Config + if args.config == "" { + config = format.find_config_file_or_default(args.path) + } else { + config = format.read_config_file_from_path_or_default(args.config) + } if args.stdin { data := make([dynamic]byte, arena_allocator) |