| 1 | package Padre::Document::ShellScript; | ||
| 2 | BEGIN { | ||
| 3 | $Padre::Document::ShellScript::VERSION = '0.03'; | ||
| 4 | } | ||
| 5 | |||
| 6 | # ABSTRACT: Shell script document support for Padre | ||
| 7 | |||
| 8 | use 5.008; | ||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | our @ISA = 'Padre::Document'; | ||
| 13 | use Padre::Document (); | ||
| 14 | |||
| 15 | sub get_command { | ||
| 16 | my $self = shift; | ||
| 17 | |||
| 18 | my $arg_ref = shift || {}; | ||
| 19 | |||
| 20 | my $debug = exists $arg_ref->{debug} ? $arg_ref->{debug} : 0; | ||
| 21 | my $trace = exists $arg_ref->{trace} ? $arg_ref->{trace} : 0; | ||
| 22 | |||
| 23 | # TODO get shebang | ||
| 24 | |||
| 25 | # Check the file name | ||
| 26 | my $filename = $self->filename; | ||
| 27 | |||
| 28 | my $dir = File::Basename::dirname($filename); | ||
| 29 | chdir $dir; | ||
| 30 | return $trace | ||
| 31 | ? qq{"sh" "-xv" "$filename"} | ||
| 32 | : qq{"sh" "$filename"}; | ||
| 33 | } | ||
| 34 | |||
| 35 | sub comment_lines_str { | ||
| 36 | return '#'; | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | # Copyright 2008-2011 The Padre development team as listed in Padre.pm. | ||
| 42 | # LICENSE | ||
| 43 | # This program is free software; you can redistribute it and/or | ||
| 44 | # modify it under the same terms as Perl 5 itself. | ||
| 45 | |||
| 46 | __END__ |