diff --git a/tools/odinfmt/flag/flag.odin b/tools/odinfmt/flag/flag.odin index 041b69df0..a943a5a1c 100644 --- a/tools/odinfmt/flag/flag.odin +++ b/tools/odinfmt/flag/flag.odin @@ -146,13 +146,11 @@ reflect_args_structure :: proc(ctx: ^Flag_Context, v: any) -> Flag_Error { tags := reflect.struct_field_tags(v.id); for name, i in names { - flag: Flag; type := types[i]; if named_type, ok := type.variant.(Type_Info_Named); ok { - if union_type, ok := named_type.base.variant.(Type_Info_Union); ok && union_type.maybe && len(union_type.variants) == 1 { flag.optional = true; flag.tag_ptr = rawptr(uintptr(union_type.tag_offset) + uintptr(v.data) + uintptr(offsets[i])); @@ -202,7 +200,6 @@ parse :: proc(v: any, args: []string) -> Flag_Error { //validate that the required flags were actually set for k, v in ctx.seen_flags { - if v.optional && v.parsed { tag_value: i32 = 1; mem.copy(v.tag_ptr, &tag_value, 4); //4 constant is probably not portable, but it works for me currently diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin index 29c1f6c1b..a651aaff0 100644 --- a/tools/odinfmt/main.odin +++ b/tools/odinfmt/main.odin @@ -68,9 +68,7 @@ main :: proc() { tick_time := time.tick_now(); if os.is_file(path) { - if _, ok := args.write.(bool); ok { - backup_path := strings.concatenate({path, "_bk"}, context.temp_allocator); if data, ok := format_file(path); ok { @@ -84,17 +82,14 @@ main :: proc() { fmt.eprintf("failed to write %v", path); } } else { - if data, ok := format_file(path); ok { fmt.println(transmute(string)data); } } } else if os.is_dir(path) { - filepath.walk(path, walk_files); for file in files { - fmt.println(file); backup_path := strings.concatenate({file, "_bk"}, context.temp_allocator);