Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 9 additions & 1 deletion bin/stow.in
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,19 @@ sub parse_options {
GetOptionsFromArray(
\@_,
\%options,
'verbose|v:+', 'help|h', 'simulate|n|no',
'verbose|v:+', 'help|h',
'version|V', 'compat|p', 'dir|d=s', 'target|t=s',
'adopt', 'no-folding', 'dotfiles',

# clean and pre-compile any regex's at parse time
'simulate|n|no' =>
sub {
$options{simulate} = 1;
unless (exists $options{verbose}) {
$options{verbose} = 1;
}
},

'ignore=s' =>
sub {
my $regex = $_[1];
Expand Down
16 changes: 15 additions & 1 deletion t/cli_options.t
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use strict;
use warnings;

use Test::More tests => 10;
use Test::More tests => 12;

use testutil;

Expand Down Expand Up @@ -109,4 +109,18 @@ make_path("$TEST_DIR/".'$HOME');
is($options->{target}, "$TEST_DIR/".'$HOME', 'no expansion');
remove_dir("$TEST_DIR/".'$HOME');

#
# Check if verbose on simulate invoked option
Comment thread
gutierri marked this conversation as resolved.
#
local @ARGV = (
'--simulate',
'-d', "$TEST_DIR/stow",
'-t', "$TEST_DIR/target",
'dummy'
);

my ($options, $pkgs_to_delete, $pkgs_to_stow) = process_options();
is($options->{simulate}, 1, 'simulate|no|n option');
is($options->{verbose}, 1, 'verbose option');

# vim:ft=perl