From 21f6ce3efc969a87917e5eb8f26b7d31c7111b1a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Fri, 17 Dec 2021 23:21:34 +0100 Subject: [PATCH] =?UTF-8?q?TT#156156=20Switch=20to=20=C2=AB-=C2=BB=20as=20?= =?UTF-8?q?the=20word=20separator=20in=20CLI=20options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The prevalent convention in the project is to use «-» instead of «_» to split words in options. Switch the options to that, and keep backwards compatibility option alias that emits a deprecation warning while people transition to the new names. The alias will be removed on the next LTS. Change-Id: I591f0b16ea9df706d717a877f9e6fc9a5ca1d20e --- bin/ngcp-dump-schema | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/ngcp-dump-schema b/bin/ngcp-dump-schema index 23751f9c..d05beee8 100644 --- a/bin/ngcp-dump-schema +++ b/bin/ngcp-dump-schema @@ -20,8 +20,23 @@ my %opt = ( dump_directory => 'lib', ); -GetOptions(\%opt, 'dump_directory:s', 'overwrite_modifications', 'version=s', 'help|?', 'man') - or die 'could not process command-line options'; +# XXX: Remove after mr10.5. +sub old_option { + my ($name, $value) = @_; + my $newname = $name =~ tr/_/-/r; + $opt{$name} = $value; + warn "$0: option --$name is deprecated; use --$newname instead\n"; +} + +GetOptions(\%opt, + 'dump_directory:s' => \&old_option, + 'dump-directory:s' => \$opt{dump_directory}, + 'overwrite_modifications' => \&old_option, + 'overwrite-modifications' => \$opt{overwrite_modifications}, + 'version=s', + 'help|?', + 'man', +) or die 'could not process command-line options'; pod2usage(-exitval => 1) if $opt{help}; pod2usage(-exitval => 0, -verbose => 2) if $opt{man}; @@ -108,11 +123,11 @@ definitions. =head1 OPTIONS -=head2 B<--dump_directory>[=I] +=head2 B<--dump-directory>[=I] Directory name for the output, default is F. -=head2 B<--overwrite_modifications> +=head2 B<--overwrite-modifications> (boolean) See L, default is false. Use with care, since this is a potentially destructive