comparison lib/CPT/Parameter/Flag.pm @ 1:d724f34e671d draft default tip

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:50:07 +0000
parents
children
comparison
equal deleted inserted replaced
0:e4de0a0e90c8 1:d724f34e671d
1 package CPT::Parameter::Flag;
2 use Moose;
3 with 'CPT::Parameter';
4
5
6
7 sub galaxy_command {
8 my ($self) = @_;
9 my $value = $self->get_galaxy_command_identifier();
10
11 # If it's hidden, specific to galaxy, and hidden from galaxy users,
12 # then it is safe to assume we've specified a SANE default.
13 if($self->hidden() && $self->_galaxy_specific()){
14 $value = $self->default();
15 }
16 my $string;
17
18 # If it's a repeat, we handle that
19 $string .= $self->handle_possible_galaxy_command_repeat_start();
20 # If it's required we set it to a value IF we have one. Otherwise value
21 # will be the galaxy_identifier.
22 if($self->required()){
23 $string .= sprintf( '--%s' . "\n",
24 $self->get_galaxy_cli_identifier()
25 );
26 }else{
27 # If
28 # This code is only relevant if we're multiple, otherwise the loop will
29 # not pass here
30 if ( !$self->multiple() ){
31 $string .= sprintf('#if $%s:' . "\n",
32 $self->get_galaxy_cli_identifier()
33 );
34 }
35 # Flag
36 $string .= sprintf( '--%s'."\n",
37 $self->get_galaxy_cli_identifier(),
38 );
39 # End
40 if ( !$self->multiple() ){
41 $string .= "#end if\n";
42 }
43 }
44 $string .= $self->handle_possible_galaxy_command_repeat_end();
45 return $string;
46 }
47
48
49
50 sub galaxy_input {
51 my ( $self, $xml_writer ) = @_;
52 $self->handle_possible_galaxy_input_repeat_start($xml_writer);
53 my %params = $self->get_default_input_parameters('boolean');
54 $params{falsevalue} = 'False';
55 $params{truevalue} = 'True';
56 if($self->default()){
57 $params{checked} = 'True';
58 }else{
59 $params{checked} = '';
60 }
61 # Remove value since we use "checked" here
62 delete $params{value};
63
64 $xml_writer->startTag(
65 'param',
66 %params,
67 );
68 $xml_writer->endTag('param');
69 $self->handle_possible_galaxy_input_repeat_end($xml_writer);
70 }
71
72
73 sub galaxy_output {
74
75 }
76
77
78 sub validate_individual {
79 my ($self) = @_;
80 return 1;
81 }
82
83
84 sub getopt_format {
85 return '';
86 }
87
88 no Moose;
89 1;
90
91 __END__
92
93 =pod
94
95 =encoding UTF-8
96
97 =head1 NAME
98
99 CPT::Parameter::Flag
100
101 =head1 VERSION
102
103 version 1.99.4
104
105 =head2 galaxy_command
106
107 $file_param->galaxy_command(); # where $file_param is a CPT::Parameter::*
108
109 Returns the portion of the command used in the <command/> block in galaxy XML files
110
111 =head2 galaxy_input
112
113 $file_param->galaxy_input($xml_writer); # where $file_param is a CPT::Parameter::*
114
115 Utilises the $xml_writer to add a <data> block in the <output> section
116
117 =head2 galaxy_output
118
119 $file_param->galaxy_output($xml_writer); # where $file_param is a CPT::Parameter::*
120
121 Utilises the $xml_writer to add a <data> block in the <output> section
122
123 =head2 getopt_format
124
125 Returns the format character for a given CPT::Parameter::* type
126
127 =head1 AUTHOR
128
129 Eric Rasche <rasche.eric@yandex.ru>
130
131 =head1 COPYRIGHT AND LICENSE
132
133 This software is Copyright (c) 2014 by Eric Rasche.
134
135 This is free software, licensed under:
136
137 The GNU General Public License, Version 3, June 2007
138
139 =cut