Skip to content

Commit 478206c

Browse files
soutaroclaude
andcommitted
Deprecate --preserve flag in rbs annotate CLI
Rewriter always preserves formatting, so the flag is no longer needed. Keep the option for backwards compatibility but mark it as deprecated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b9f5cdd commit 478206c

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/rbs/cli.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,6 @@ def run_annotate(args, options)
962962
source = RBS::Annotate::RDocSource.new()
963963
annotator = RBS::Annotate::RDocAnnotator.new(source: source)
964964

965-
preserve = true
966-
967965
OptionParser.new do |opts|
968966
opts.banner = <<-EOB
969967
Usage: rbs annotate [options...] [files...]
@@ -984,7 +982,7 @@ def run_annotate(args, options)
984982
opts.on("-d", "--dir DIRNAME", "Load RDoc from DIRNAME") {|d| source.extra_dirs << Pathname(d) }
985983
opts.on("--[no-]arglists", "Generate arglists section (defaults to true)") {|b| annotator.include_arg_lists = b }
986984
opts.on("--[no-]filename", "Include source file name in the documentation (defaults to true)") {|b| annotator.include_filename = b }
987-
opts.on("--[no-]preserve", "Try preserve the format of the original file (defaults to true)") {|b| preserve = b }
985+
opts.on("--[no-]preserve", "[Deprecated] It always preserves the format") { stdout.puts "The `--preserve` option is deprecated. The tool always preserves the format of RBS files." }
988986
end.parse!(args)
989987

990988
source.load()
@@ -994,11 +992,11 @@ def run_annotate(args, options)
994992
if path.directory?
995993
Pathname.glob((path + "**/*.rbs").to_s).each do |path|
996994
stdout.puts "Processing #{path}..."
997-
annotator.annotate_file(path, preserve: preserve)
995+
annotator.annotate_file(path)
998996
end
999997
else
1000998
stdout.puts "Processing #{path}..."
1001-
annotator.annotate_file(path, preserve: preserve)
999+
annotator.annotate_file(path)
10021000
end
10031001
end
10041002

0 commit comments

Comments
 (0)