From afe46a308a893a1ea4be1d04d70f8c8f2ffa9c57 Mon Sep 17 00:00:00 2001 From: TLINDEN Date: Wed, 14 Nov 2012 11:04:35 +0100 Subject: [PATCH] added 'motd' and changed prompt to show readonly status, if any --- Changelog | 6 ++++++ README | 4 ++-- VERSION | 2 +- bin/note | 32 +++++++++++++++++++++++++++----- config/noterc | 7 ++++++- note.pod | 2 +- 6 files changed, 43 insertions(+), 10 deletions(-) diff --git a/Changelog b/Changelog index 10345b4..a032073 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,9 @@ +1.3.14: +ADDED: new config parameter 'motd', a note entry which will be shown + on startup (if exists). +CHANGED: the prompt will now show if the current instance is running + in readonly mode. +================================================================================ 1.3.12: FIXED: NOTEDB::general data backend module did overwrite records if there were some deleted ones in the database. diff --git a/README b/README index f0af4a4..a8b18c2 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -note 1.3.12 by Thomas Linden, 07/19/2012 +note 1.3.13 by Thomas Linden, 14/11/2012 ======================================= Introduction @@ -214,4 +214,4 @@ and I'll add you. Last changed ============ -07/19/2012 +14/11/2012 \ No newline at end of file diff --git a/VERSION b/VERSION index 0c00f61..7962dcf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.10 +1.3.13 diff --git a/bin/note b/bin/note index 5be1a53..0270667 100755 --- a/bin/note +++ b/bin/note @@ -133,7 +133,8 @@ my ( 'topicseparator' => '/', 'printlines' => 0, 'cache' => 0, - 'preferrededitor' => '' + 'preferrededitor' => '', + 'motd' => '' ); # these are not customizable at runtime! @@ -143,7 +144,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc"); $USER = getlogin || getpwuid($<); chomp $USER; $TOPIC = 1; -$version = "1.3.12"; +$version = "1.3.13"; $CurDepth = 1; # the current depth inside the topic "directory" structure... $maxlen = "auto"; $timelen = 22; @@ -534,7 +535,15 @@ sub encrypt_passwd { print "Encrypted password:\n$crypt_string\n"; } } - +############################### MOTD ################################## +sub motd { + my($N,$match,$note,$date,$num); + # display a configured motd note, if any + ($note, $date) = $db->get_single($conf{motd}); + if ($note) { + print "\n\n$note\n\n"; + } +} ############################### DISPLAY ################################## sub display { @@ -1044,6 +1053,13 @@ sub interactive { # Initially do a list command! &determine_width; $ListType = ($conf{defaultlong}) ? "LONG" : ""; + + # show initial note entry + if ($conf{motd}) { + &motd; + } + + # show initial listing &list; my ($term, $prompt, $attribs); @@ -1058,12 +1074,18 @@ sub interactive { $ListType = ($conf{defaultlong}) ? "LONG" : ""; undef $SetTitle; if ($CurDepth > 2) { - print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC . ">"; + print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC; } else { - print C $menu . $TOPICC . $CurTopic . $_TOPICC . ">"; + print C $menu . $TOPICC . $CurTopic . $_TOPICC; } + if ($conf{readonly}) { + print " [readonly] "; + } + + print ">"; + # endless until user press "Q" or "q"! if ($term) { if (defined ($char = $term->readline(" "))) { diff --git a/config/noterc b/config/noterc index cc22abe..f239d6f 100644 --- a/config/noterc +++ b/config/noterc @@ -1,4 +1,4 @@ - # note 1.3.8 -*- sh -*- + # note 1.3.13 -*- sh -*- # # This is a sample config for the note script # There are useful defaults set in note itself. @@ -277,6 +277,11 @@ PrintLines = NO AddTicket = NO + # + # Show an entry on startup. If you want it, create such an entry + # and supply its number here +motd = + # # diff --git a/note.pod b/note.pod index c2d6abe..1ba21f6 100644 --- a/note.pod +++ b/note.pod @@ -535,6 +535,6 @@ Thomas Linden =head1 VERSION -1.3.12 (07/19/2012) +1.3.13 (14/11/2012) =cut