|
Revision 4218, 1.0 kB
(checked in by yappo, 5 years ago)
|
|
lang/perl/Config-Pit: code golf nized
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | use strict; |
|---|
| 3 | use warnings; |
|---|
| 4 | use FindBin; |
|---|
| 5 | use Path::Class; |
|---|
| 6 | use YAML; |
|---|
| 7 | use File::Temp; |
|---|
| 8 | use Pod::Usage; |
|---|
| 9 | |
|---|
| 10 | use lib file( $FindBin::RealBin, '..', 'lib' )->stringify; |
|---|
| 11 | use Config::Pit; |
|---|
| 12 | |
|---|
| 13 | ({ |
|---|
| 14 | get => sub { printf "%s\n", YAML::Dump(Config::Pit::get(shift)) }, |
|---|
| 15 | set => \&Config::Pit::set, |
|---|
| 16 | switch => \&Config::Pit::switch, |
|---|
| 17 | }->{(shift || '')} || sub { pod2usage } )->($ARGV[1]); |
|---|
| 18 | |
|---|
| 19 | __END__ |
|---|
| 20 | |
|---|
| 21 | =head1 SYNOPSIS |
|---|
| 22 | |
|---|
| 23 | $ ppit [get|set|switch] <value> |
|---|
| 24 | $ ppit help |
|---|
| 25 | |
|---|
| 26 | Options: |
|---|
| 27 | get <name> => Get values of <name>. |
|---|
| 28 | set <name> => Config values of name with $EDITOR. |
|---|
| 29 | switch <profile> => Switch profile to <profile>. |
|---|
| 30 | help => show this manual |
|---|
| 31 | |
|---|
| 32 | =head1 DESCRIPTION |
|---|
| 33 | |
|---|
| 34 | pit command for Perl |
|---|
| 35 | |
|---|
| 36 | =head1 AUTHOR |
|---|
| 37 | |
|---|
| 38 | Kazuhiro Osawa |
|---|
| 39 | |
|---|
| 40 | =head1 LICENSE |
|---|
| 41 | |
|---|
| 42 | This library is free software; you can redistribute it and/or modify |
|---|
| 43 | it under the same terms as Perl itself. |
|---|
| 44 | |
|---|
| 45 | =head1 SEE ALSO |
|---|
| 46 | |
|---|
| 47 | L<pit gem|http://lowreal.rubyforge.org/pit/> |
|---|
| 48 | C<Config::Pit> |
|---|
| 49 | |
|---|
| 50 | =cut |
|---|
| 51 | |
|---|