App-devmode
view release on metacpan or search on metacpan
bin/devmode view on Meta::CPAN
}
shift @ARGV;
my $search = pop @ARGV;
if ($search) {
@names = grep { /$search/ } @names;
}
print join ' ', @names;
exit 0;
}
exit 1;
}
sub remote_cache {
my ($server) = @_;
my $cache = {};
my $cache_file = file('/tmp/devmode_remoter_cache');
if ( -f $cache_file ) {
$cache = LoadFile($cache_file);
}
# check the cache is fresh (1 day)
if ( $cache->{$server} && $cache->{$server}{last} > time - 1 * 24 * 60 * 60 ) {
return @{ $cache->{$server}{modes} };
}
$cache->{$server}{last} = time;
$cache->{$server}{modes}
= [
grep {
!/[.]rc$/ && !/^#/
}
map {
m{^(?:.*/)(.*)};
$1
}
split /\n/,
'' . `ssh $option{server} '/bin/ls -1 ~/.devmode/[^.#]*'`
];
DumpFile($cache_file, $cache);
return @{ $cache->{$server}{modes} };
}
sub config {
my ($base) = @_;
my $base_config = "$HOME/.devmode/$base.rc";
my $devmode = "$HOME/.devmode.rc";
my $config = {};
if ( -e $base_config ) {
$config = eval { LoadFile($base_config) };
# if no config found and we have an error assume that the file is old
# format and try to require it and convert to YAML.
if ( !$config && $@ ) {
$config = require $base_config;
DumpFile($base_config, $config);
}
}
if ( -e $devmode ) {
$config = { %{ LoadFile($devmode) }, %$config };
}
return $config
}
=head1 NAME
devmode - Wrapper for GNU screen to manage multiple screenrc files
=head1 VERSION
This documentation refers to devmode version 0.0.8.
=head1 SYNOPSIS
devmode <task>
OPTIONS:
<task> The name of a screen config found in the ~/.devmode/ directory
-k --kill Kill the task
-l --list List all running devmode tasks
-a --all Makes --list show even non-running sessions
-e --exists Only run screen if a devmode file exists by that name
-x --multiconnect
Connect to session with out disconnecting existing session
-c --create Creates a missing devmode task
-d --chdir Parse the config and change directory to the last chdir command
found in there.
-f --force-title
Try harder to set the terminal title
-t --template=name
Uses this template name for creating the missing task. The
default template is rc other templates can be stored in the
$HOME/.devmode/templates/ directory
-p --protect Run a surrounding screen session to protect the intended
session from ssh-agent being lost when logging out of the
of box. (experimental 256 colours doesn't work is sub screen)
-s --server=str
Use a remote server to connect to and run devmode. The server
may include username@ to login with a particular user.
-S --short Don't show "Devmode" in the title bar
-A --auto=str
Allows a BASH command line completion mode helper mode to run
-T --test Don't run any external commands
--VERSION Prints the version information
--help Prints this help information
--man Prints the full documentation for devmode
=head1 DESCRIPTION
C<devmode> makes managing screen sessions simpler by managing session names
and configuration files.
( run in 0.759 second using v1.01-cache-2.11-cpan-e1769b4cff6 )