| 1 | #!/usr/bin/perl -w | ||
| 2 | use Term::ANSIColor qw(:constants); | ||
| 3 | # vi:fdm=marker fdl=0: | ||
| 4 | |||
| 5 | $Term::ANSIColor::AUTORESET = 1; | ||
| 6 | |||
| 7 | |||
| 8 | my($path) = $0 =~ /^(.*)\//; | ||
| 9 | push @INC,$path; | ||
| 10 | require BugCli; | ||
| 11 | |||
| 12 | |||
| 13 | my ($shell) = BugCli->new; | ||
| 14 | print BLUE . ">> " . GREEN | ||
| 15 | . "Welcome to BugZilla CLI by Reflog v$shell->{API}{version}" | ||
| 16 | . BLUE . " <<" | ||
| 17 | . CLEAR . "\n"; | ||
| 18 | if (not $shell->read_config() ) { | ||
| 19 | $shell->run_config(); | ||
| 20 | $shell->unload_defaults(); | ||
| 21 | } | ||
| 22 | $shell->init_mysql(); | ||
| 23 | if ( not @ARGV ) { # no params, start interactive mode | ||
| 24 | $shell->cmdloop; | ||
| 25 | } | ||
| 26 | else { #got params. parse and start working. | ||
| 27 | my (@commands) = split /;/, $ARGV[0]; | ||
| 28 | print RED | ||
| 29 | . " WARNING: " | ||
| 30 | . RESET | ||
| 31 | . "All commands are your responsibility!\n"; | ||
| 32 | foreach (@commands) { | ||
| 33 | print BLUE . ">> " . GREEN | ||
| 34 | . "Executing: " | ||
| 35 | . RESET | ||
| 36 | . $_ | ||
| 37 | . BLUE . " <<" | ||
| 38 | . RESET . "\n"; | ||
| 39 | $shell->cmd($_); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | |||
| 43 | $shell->write_config(); | ||
| 44 | |||
| 45 | 1; | ||
| 46 | |||
| 47 | __END__ |