-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathalios
129 lines (83 loc) · 3.63 KB
/
alios
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/usr/bin/perl
use utf8;
use 5.010;
use strict;
use warnings;
use vars qw( $VERSION );
use App::alios qw(:all);
use Term::ANSIColor;
use Getopt::Std;
use open qw< :encoding(UTF-8) >;
use autodie;
$VERSION = "v2.9";
my $opt = {};
getopts('vsd:pm:n:h', $opt);
sub version {
print "$VERSION\n";
}
sub search {
my $app = init();
for(@$app){
print " " x (length $_->{id}) . $_->{name} . colored(['yellow'], "__") . colored(['black on_yellow'], " $_->{nr}") . "\n";
}
}
sub show {
my $apps = conf();
print colored(['black on_yellow'], " alios "); for my $app(@$apps){ print " $app->{alios}" }; print " " . colored(['black on_yellow'], " ") . "\n";
}
sub help {
print "\n" . colored(['bold white'], "alios") . " - CLI tool for quick jumps into iOS app folders\n\n"
. "\t" . colored(['bold white'], "-v") . " show version\n"
. "\t" . colored(['bold white'], "-p") . " repath\n"
. "\t" . colored(['bold white'], "-s") . " search for installed apps\n"
. "\t" . colored(['bold white'], "-m") . " map alios\n"
. "\t" . colored(['bold white'], "-d") . " delete mapped alios\n"
. "\t" . colored(['bold white'], "-h") . " show this help\n\n"
. colored(['bold white'], "E.g") . "\n"
. "\t'" . colored(['bold white'], "alios -p") . "' repath the path to app home folders\n"
. "\t'" . colored(['bold white'], "alios -s") . "' search for installed apps\n"
. "\t'" . colored(['bold white'], "alios -m 44 -n somename") . "' map 44th app to somename\n"
. "\t'" . colored(['bold white'], "alios") . "' list alioses\n"
. "\t'" . colored(['bold white'], "somename") . "' jump to somename app folder\n"
. "\t'" . colored(['bold white'], "find \$SOMENAME -name \'*.jpg\'") . "' find jpg files in somename app folder\n"
. "\t'" . colored(['bold white'], "open \$somename") . "' open somename app\n"
. "\t'" . colored(['bold white'], "alios -d name") . "' delete alios\n\n";
}
if($opt->{m} and $opt->{n}){ $map->($opt->{m}, $opt->{n}); print "'" . colored(['bold white'], "source ~/.alios") . "' to make changes available.\n" }
elsif($opt->{s}){ search }
elsif($opt->{p}){ conf(1) }
elsif($opt->{d}){ del($opt->{d}) and print "Restart shell session '" . colored(['bold white'], "exec \$SHELL") . "' to make changes available.\n" }
elsif($opt->{h}){ help }
elsif($opt->{v}){ version }
else { show };
=encoding utf8
=head1 NAME
App::alios - tool for quick jumps into iOS app folders
=head1 VERSION
This document describes alios version 2.9
=head1 SYNOPSIS
C<-v> show version
C<-p> app folder names are changing, this option will update path in ~/.alios config file. To have paths updated at the start of bash session add following line to your ~/.bashrc file 'alios -p && if [ -f ~/.alios ];then source ~/.alios; fi'
C<-s> search for installed apps
C<-m> map alios
C<-d> delete alios
C<-h> show help
=head1 DESCRIPTION
Creates shell variable '$APP' holding app home folder path, alias 'app' pointing to app home folder and shell variable '$app' holding app id.
=head1 EXAMPLES
C<alios -p> repath the path to app home folders
C<alios -s> search for installed apps
C<alios -m 44 -n name> map 44th app to somename
C<somename> jump to somename app folder
C<find $SOMENAME -name '*jpg'> find jpg files in somename app folder
C<open $somename> open somename app
C<alios> list alioses
C<alios -d name> delete alios
=head1 DEVELOPMENT
alios is hosted on L<github|https://github.com/z448/alios>. You can track and contribute to its development there.
=head1 AUTHOR
Zdeněk Bohuněk, C<< <[email protected]> >>
=head1 COPYRIGHT
Copyright © 2016-2023, Zdeněk Bohuněk C<< <[email protected]> >>. All rights reserved.
This code is available under the Artistic License 2.0.
=cut