Commit ed8250dee67ffd20b57b580c143d68d507dc799b
- Diff rendering mode:
- inline
- side by side
timelog-update-tasks
(20 / 11)
|   | |||
| 1 | 1 | #!/usr/bin/perl | |
| 2 | use utf8; | ||
| 2 | 3 | use strict; | |
| 3 | 4 | use warnings; | |
| 4 | 5 | use feature 'say'; | |
| … | … | ||
| 9 | 9 | use File::Slurp; | |
| 10 | 10 | use Term::ReadPassword; | |
| 11 | 11 | use Config::IniFiles; | |
| 12 | use utf8; | ||
| 12 | use Getopt::Long; | ||
| 13 | 13 | ||
| 14 | 14 | use constant SCRIPTURL => 'http://intranet.colivre.coop.br'; | |
| 15 | 15 | ||
| 16 | my $local = undef; | ||
| 17 | GetOptions(local => \$local); | ||
| 18 | |||
| 16 | 19 | my $mech = WWW::Mechanize::TWiki->new(agent => 'colivre-robot', autocheck => 1 ) or die $!; | |
| 17 | 20 | $mech->cgibin(SCRIPTURL, { scriptSuffix => '' }); | |
| 18 | 21 | ||
| … | … | ||
| 62 | 62 | ||
| 63 | 63 | my $conf = Config::IniFiles->new(-file => "$ENV{HOME}/.gtimelog/gtimelogrc"); | |
| 64 | 64 | my $remote_user = $conf->val('gtimelog', 'remote-user') || 'YourWikiName'; | |
| 65 | print "wikiname [$remote_user]: "; | ||
| 66 | chomp(my $username = <STDIN>); | ||
| 67 | if ($username) { | ||
| 68 | $conf->setval('gtimelog', 'remote-user', $username); | ||
| 65 | |||
| 66 | my $remote_tasks = ''; | ||
| 67 | unless ($local) { | ||
| 68 | print "wikiname [$remote_user]: "; | ||
| 69 | chomp(my $username = <STDIN>); | ||
| 70 | if ($username) { | ||
| 71 | $conf->setval('gtimelog', 'remote-user', $username); | ||
| 72 | } | ||
| 73 | else { | ||
| 74 | $username = $remote_user; | ||
| 75 | } | ||
| 76 | my $password = read_password('senha: '); | ||
| 77 | logon($username, $password); | ||
| 78 | $remote_tasks = get_remote_tasks; | ||
| 69 | 79 | } | |
| 70 | else { | ||
| 71 | $username = $remote_user; | ||
| 72 | } | ||
| 73 | 80 | ||
| 74 | my $password = read_password('senha: '); | ||
| 75 | logon($username, $password); | ||
| 76 | concat_tasks(get_remote_tasks, get_local_tasks); | ||
| 81 | concat_tasks($remote_tasks, get_local_tasks); | ||
| 77 | 82 | ||
| 78 | 83 | $conf->RewriteConfig; |

