From 70e4c583fddebd803751e3e6b525fa70375118f2 Mon Sep 17 00:00:00 2001 From: legatvs Date: Wed, 26 Nov 2008 01:37:14 +0200 Subject: [PATCH] Changed status messages to "[$verb] $msg" format. --- CHANGES | 6 ++++++ clivefeed | 12 ++++++------ clivepass | 18 +++++++++--------- clivescan | 18 +++++++++--------- 4 files changed, 30 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index 735072f..d22f2ba 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +Version 2.0 + + User-visible changes: + * Changed status messages to "[$verb] $msg" format + + Version 2.0beta3 (November 22, 2008) diff --git a/clivefeed b/clivefeed index 6e12e8d..c113a20 100755 --- a/clivefeed +++ b/clivefeed @@ -139,7 +139,7 @@ sub fetch_feed { my ($url, $response, $rc) = (shift, "", 0); open my $rfh, ">", \$response; - print "Fetching $url ..." unless $opts{quiet}; + print "[fetch] $url ..." unless $opts{quiet}; $curl->setopt(CURLOPT_URL, $url); $curl->setopt(CURLOPT_ENCODING, ""); $curl->setopt(CURLOPT_WRITEDATA, $rfh); @@ -150,7 +150,7 @@ sub fetch_feed { print "done.\n" unless $opts{quiet}; process_feed($url, $response); } else { - print STDERR "\nerror: " .$curl->strerror($rc)." (http/$rc)\n"; + print STDERR "\n[error] " .$curl->strerror($rc)." (http/$rc)\n"; } close $rfh; } @@ -160,7 +160,7 @@ sub fetch_feed { sub get_queue { if ( $opts{paste} ) { - print STDERR "error: Clipboard module not found" and exit + print STDERR "[error] Clipboard module not found" and exit unless $opted_mods{Clipboard}; my $data = Clipboard->paste(); if ( $data ) { @@ -182,7 +182,7 @@ sub process_queue { sub process_feed { my ($url, $response) = @_; - print "=> Processing feed ..." unless $opts{quiet}; + print "=> [process] feed ..." unless $opts{quiet}; my $rss = XML::RSS::LibXML->new; $rss->parse($response); @@ -215,13 +215,13 @@ sub parse_input { } sub find_clive { - print "Trying to locate 'clive' ..." unless $opts{quiet}; + print "[locate] clive ..." unless $opts{quiet}; find ( sub { $opts{clive} = $File::Find::name if ( $_ eq 'clive' ) }, split /:/, $ENV{PATH} || getcwd); if ( $opts{clive} ) { print "$opts{clive}\n" unless $opts{quiet}; } - else { print STDERR "error: not found, use --clive=path\n"; exit; } + else { print STDERR "\n[error] not found, use --clive=path\n"; exit; } } sub run_clive { diff --git a/clivepass b/clivepass index 93173a9..401f941 100755 --- a/clivepass +++ b/clivepass @@ -85,7 +85,7 @@ sub create_passwd { $phrase = getpass("Enter passphrase: ") while ( ! $phrase ); $again = getpass("Enter passphrase again: ") while ( ! $again ); - print STDERR "error: passphrases did not match\n" and exit + print STDERR "[error] passphrases did not match\n" and exit unless $phrase eq $again; my $passwd = Config::Tiny->new; @@ -98,14 +98,14 @@ sub create_passwd { sub verify_phrase { my ($phrase_hash) = @_; - print STDERR "error: $PASSWDFILE: phrase hash not found\n" and exit + print STDERR "[error] $PASSWDFILE: phrase hash not found\n" and exit unless $phrase_hash; my $phrase; $phrase = getpass("Enter passphrase: ") while ( ! $phrase ); if ( unix_md5_crypt($phrase, $phrase_hash) ne $phrase_hash ) { - print STDERR "error: invalid passphrase\n"; + print STDERR "[error] invalid passphrase\n"; exit; } return $phrase; @@ -114,14 +114,14 @@ sub verify_phrase { sub get_key { my ($dupl_user) = @_; - print STDERR "error: $PASSWDFILE does not exist, use --create\n" + print STDERR "[error] $PASSWDFILE does not exist, use --create\n" and exit if ( ! -e $PASSWDFILE ); my $passwd = Config::Tiny->read($PASSWDFILE); if ( $dupl_user ) { my ($id, $pwd) = lookup_login($passwd, $dupl_user); - print STDERR qq/error: login with the "$dupl_user" / + print STDERR qq/[error] login with the "$dupl_user" / . "username exists already\n" and exit if $pwd; } @@ -153,7 +153,7 @@ sub new_login { $pwd = getpass("Enter password for $user: ") while ( ! $pwd ); $again = getpass("Re-enter the password: ") while ( ! $again ); - print STDERR "error: passwords did not match\n" and exit + print STDERR "[error] passwords did not match\n" and exit unless $pwd eq $again; my $c = Crypt::Twofish2->new($key, Crypt::Twofish2::MODE_CBC); @@ -173,7 +173,7 @@ sub edit_login { my ($key, $passwd) = get_key(); my ($id, $pwd) = lookup_login($passwd, $opts{edit}); - print STDERR qq/error: no such login with the "$opts{edit}" / + print STDERR qq/[error] no such login with the "$opts{edit}" / . "username exists\n" and exit unless $pwd; print "WARN: Changing password for the login " @@ -186,7 +186,7 @@ sub get_login { my ($key, $passwd) = get_key(); my ($id, $pwd) = lookup_login($passwd, $opts{get}); - print STDERR qq/error: no such login with the "$opts{get}" / + print STDERR qq/[error] no such login with the "$opts{get}" / . "username exists\n" and exit unless $pwd; my $c = Crypt::Twofish2->new($key, Crypt::Twofish2::MODE_CBC); @@ -197,7 +197,7 @@ sub delete_login { my ($key, $passwd) = get_key(); my ($id, $pwd) = lookup_login($passwd, $opts{delete}); - print STDERR qq/error: no such login with the "$opts{delete}" / + print STDERR qq/[error] no such login with the "$opts{delete}" / . "username exists\n" and exit unless $pwd; print "WARN: About to delete the login with the username " diff --git a/clivescan b/clivescan index ac428fc..7383e6b 100755 --- a/clivescan +++ b/clivescan @@ -152,7 +152,7 @@ sub fetch_page { sub get_queue { if ( $opts{paste} ) { - print STDERR "error: Clipboard module not found" and exit + print STDERR "[error] Clipboard module not found" and exit unless $opted_mods{Clipboard}; my $data = Clipboard->paste(); if ( $data ) { @@ -170,7 +170,7 @@ sub get_queue { sub process_queue { init_curl(); foreach ( @queue ) { - print "Fetching $_ ..." unless $opts{quiet}; + print "[fetch] $_ ..." unless $opts{quiet}; my ($rc, $fh, $resp, $errmsg) = fetch_page($_); if ( $rc == 0 ) { $rc = $curl->getinfo(CURLINFO_RESPONSE_CODE); @@ -183,7 +183,7 @@ sub process_queue { $errmsg = $curl->strerror($rc)." (http/$rc)"; } close $fh; - print STDERR "\n==> error: $errmsg\n" if $errmsg; + print STDERR "\n==> [error] $errmsg\n" if $errmsg; } } @@ -255,7 +255,7 @@ sub scan_page { # Embed URL: http://embed.break.com/600081 ); - print "=> Scanning page for links " unless $opts{quiet}; + print "=> [scan] page" unless $opts{quiet}; sub _scan_progress { my ($linksref, $link) = @_; @@ -278,12 +278,12 @@ sub scan_page { my %h = map { $_, 1 } @links; # Weed out duplicates @links = keys %h; - print "\n=> Found " .scalar @links. " links after removing duplicates.\n" + print " found " .scalar @links. " link(s).\n" unless $opts{quiet}; my %verified_links; foreach my $link ( @links ) { - print "==> Fetching $link ..." unless $opts{quiet}; + print "==> [fetch] $link ..." unless $opts{quiet}; my ($rc, $fh, $resp, $errmsg) = fetch_page($link); if ( $rc == 0 ) { $rc = $curl->getinfo(CURLINFO_RESPONSE_CODE); @@ -304,7 +304,7 @@ sub scan_page { $errmsg = $curl->strerror($rc)." (http/$rc)"; } close $fh; - print STDERR "\n==> error: $errmsg\n" if $errmsg; + print STDERR "\n==> [error] $errmsg\n" if $errmsg; } $found_queue{ sha1_hex($scanurl) } = @@ -336,13 +336,13 @@ sub parse_input { } sub find_clive { - print "Trying to locate 'clive' ..." unless $opts{quiet}; + print "[locate] clive ..." unless $opts{quiet}; find ( sub { $opts{clive} = $File::Find::name if ( $_ eq 'clive' ) }, split /:/, $ENV{PATH} || getcwd); if ( $opts{clive} ) { print "$opts{clive}\n" unless $opts{quiet}; } - else { print STDERR "error: not found, use --clive=path\n"; exit; } + else { print STDERR "\n[error] not found, use --clive=path\n"; exit; } } sub run_clive { -- 2.11.4.GIT