12 Commits

Author SHA1 Message Date
T. von Dein
9dc71d1885 moving to codeberg (#13) 2025-12-15 20:45:06 +01:00
4f06a9f8f5 STDIN related fixes
- fixed https://rt.cpan.org/Ticket/Display.html?id=155578: adding a
new entry from STDIN now works regardless of interactive seting.

- added new flag -n

- fixed note number argument

- code reorganized
2024-09-24 18:40:13 +02:00
bb5779a664 added latest changes 2024-09-05 18:10:15 +02:00
dbaf515259 Fix https://github.com/TLINDEN/note/issues/11:
- rewrite documentation sections regarding database backends.
- add depcreation announcement to README
- enhanced default config to reflect the new default file extensions
- enhanced error message when Encryption is set to off but a binary
  file is being encountered.
- bump version to 1.4.1
2024-09-05 17:55:08 +02:00
891f830cba Fix confusion of new users regarding db files.
Now, we're using a different file extension for every db file
type. That way, if the user tries another file type and forgets to
specify a filename, the default is NOT to use the same one as before,
but another file. That way the message "file is encrypted" will not
appear anymore, if a new user follows the above steps.
2024-09-05 17:17:36 +02:00
37e73950da added JSON export format:
Starting with version 1.4 JSON export format will be supported but
not be enabled by default. However a deprecation notice will appear if
a user still uses YAML format. YAML support will be removed in version
1.5.

Fixes https://github.com/TLINDEN/note/issues/10.
2023-08-13 19:05:29 +02:00
1b842625ed syncer enhancements:
- if two entries of the same title exist in both exported databases,
show a diff and ask the user which one to use (or both).

- write the result directly to a file.
2023-08-13 11:49:45 +02:00
c03d521b2c fixed-newlines 2023-08-12 20:24:18 +02:00
53c16708fe Added script to recombine 2 dumps into a new one." 2023-08-11 20:15:36 +02:00
T.v.Dein
4505ec70a4 Merge pull request #8 from eamanu/fix-new-spelling
[WIP] fix-spelling
2019-06-05 15:55:44 +02:00
Emmanuel Arias
c5cdc42445 more fix 2019-05-09 01:09:12 +00:00
Emmanuel Arias
ec2a36b4ad fix-spelling
Fix spelling on several filesIndex: note/lib/NOTEDB/README

Gbp-Pq: Name 0001-fix-spelling.patch
Signed-off-by: Emmanuel Arias <emmanuelarias30@gmail.com>
2019-05-09 01:06:37 +00:00
17 changed files with 1157 additions and 1013 deletions

746
Changelog

File diff suppressed because it is too large Load Diff

217
README
View File

@@ -1,217 +0,0 @@
note 1.3.20 by T.v.Dein (09/02/2015)
=======================================
Introduction
============
This is a small console program written in
perl, which allows you to manage notes similar
to programs like "knotes" from commandline.
There are currently three different database backends,
which you can use with note:
o NOTEDB::binary - this is the default backend
and uses a binary file to store your notes.
o NOTEDB::mysql - this backend uses a mysql
database to store your notes. You can switch
easily to another DBMS since this module uses
the Perl standard module "DBI" for database-
access. See below for more info on this topic!
o NOTEDB::dbm - this module uses two DBM files
for data storage and requires the module DB_FILE,
which is part of the perl standard distribution.
See below for more details about the DBM module.
o NOTEDB::general - uses the module Config::General
for storage, which makes the data file portable,
since it is a plain ascii file (binary content
will be base64 encoded).
o NOTEDB::text - uses the Storable module for data
storage (a serializer). Storable is included with
perl, and since it's written in C, it's very fast.
But the resulting data files are not that portable
as the once of NOTEDB::general are.
Where to get?
=============
By now you can download it at http://www.daemon.de/NOTE.
If you are using debian, you can apt-get it. If you are
using gentoo, you can emerge it.
You may also try your nearest tucows or freshmeat mirror.
Features
========
o Several different database backends, mysql(DBI), dbm,
binary(bin file), general and text (text files).
o Commandline interface using the standard perl module
Getopt::Long, which allows you to use short or long
command-line options.
o Interactive interface(pure ascii), the following functions
are available in interactive mode: list, display, topic,
delete, edit, help.
o Highly confiurable using a perlish configfile ~/.noterc.
although it is configurable it is not required, note can
run without a configfile using useful default presets.
o Colourized output is supported using ASCII Escape-Sequences.
o The user can customize the color for each item.
o Data can be stored in various different database backends,
since all database access is excluded from the program itself
in perl modules.
o Notes can be deleted, edited and you can search trough your notes.
o Notes can be categorized. Each category(topic) can contain multiple
notes and even more sup-topics. There is no limitation about
sub topics.
o You can view all notes in a list and it is possible only to view
notes under a certain topic.
o There is a tree-view, which allows you to get an overview of your
topic-hierarchy.
o Notes can be encrypted using DES or IDEA algorythms and Crypt::CBC.
o You can dump the contents of your note database into a plain text
file, which can later be imported. Imports can be appended or it can
overwrite an existing database (-o).
o Note has scripting capabilities, you can create a new note by piping
another commands output to note, you can also import a notedump from
stdin as well es duming to stdout instead a file. Additional, there
is an option --raw available, which prints everything out completely
without formatting.
o for better performance, note can cache the database for listings
or searching.
o It can be installed without root-privileges.
o if Term::ReadLine (and Term::ReadLine::Gnu) is installed, history
and auto-completion are supported in interactive mode.
o Last, a while ago a user stated: "... it simply does, what it
says ..."
Requirements
============
You need the following things:
o perl installed (5.004x)
o The module IO::Seekable and Fcntl, which should be
already installed with your perl distributuion if
you want to use the binary database backend.
o DBI module and DBI::mysql if you want to use the
mysql database backend.
o The module DB_FILE if you want to use the DBM module.
o Getopt::Long (part of perl std ditribution)
o Term::ReadLine and optionally Term::ReadLine::Gnu if
you want to use the auto-completion and history functionality.
o Config::General if you want to use the NOTEDB::general
backend.
Installation
============
Unpack the tar-ball and issue the following command:
$ perl Makefile.PL
This creates the Makefile neccessary for installing.
You may add some additional variables to the commandline, the
most important one is PREFIX.
Then enter the following command to prepare the installation
process:
$ make
After that, you are ready to install. Become root and issue:
# make install
The installation process installs all modules for every available
data backends. The default note configuration does not require
additional perl modules.
If you want to use the mysql backend refer to the installation
instructions for the mysql database installation in mysql/README.
If you want to use encryption support, you will need at least
Crypt:CBC and Crypt::Blowfish (or Crypt::DES or whatever).
Configuration
=============
This version of note doesn't neccessarily need
a configuration file. But you can have one and change
some default values. Take a look to the file config/noterc
provided with this tarball. There are detailed instructions
about every available parameter.
Simply copy this file into your home-directory and name it
.noterc
If you decide not to use the default database backend (a binary
file), you will *need* a configuration!
Usage
=====
Refer to the note(1) manpage for usage instructions.
Comments
========
You can send any comments to Thomas Linden <tom at linden dot at>.
If you find a bug or if you have a suggestion for improvement of the
script feel free to send me a patch ;-)
License
=======
This program comes with absolutely NO WARRANTY. It is distributed under
the terms of the GNU General Public License. Use it at your own risk :-)
You can read the complete GPL at: http://www.gnu.org/copyleft/gpl.html
Recources
=========
The command-line options and all commands of the interactive mode are
described in the supplied note(1) manpage.
You may also refer to the note website http://www.daemon.de/note/.
Author and Copyright
====================
The author is T.v.Dein
note is Copyright of T.v.Dein
Contributors / Credits
======================
Shouts to all those guys who helped me to enhance note: THANKS A LOT!
Jens Heunemann <jens.heunemann@consol.de> - sub tree.
Peter Palmreuther - various additions.
And many other people who sent bug reports, feature requests. If you
feel that I forgot your name in this list, then please send me an email
and I'll add you.
Last changed
============
09/02/2015

213
README.md Normal file
View File

@@ -0,0 +1,213 @@
# note - a perl script for maintaining notes.
This is the perl script 'note' in version 1.4.2 from 24/09/2024.
## Introduction
This is a small console program written in perl, which allows you to
manage notes similar to programs like "knotes" from command line.
There are a couple of different databases backends, which you can use
with note:
* **binary** - this is the default backend
and uses a binary file to store your notes.
* **mysql** - this backend uses a mysql
database to store your notes. You can switch
easily to another DBMS since this module uses
the Perl standard module "DBI" for database-
access. See below for more info on this topic!
* **dbm** - this module uses two DBM files
for data storage and requires the module DB_FILE,
which is part of the perl standard distribution.
See below for more details about the DBM module.
* **general** - uses the module Config::General
for storage, which makes the data file portable,
since it is a plain ascii file (binary content
will be base64 encoded).
* **text** - uses the Storable module for data
storage (a serializer). Storable is included with
perl, and since it's written in C, it's very fast.
But the resulting data files are not that portable
as the once of NOTEDB::general are.
* **pwsafe3** - uses the
[PWSAFE3](https://github.com/pwsafe/pwsafe/blob/master/docs/formatV3.txt)
file format, which is securely encrypted. The file can be opened
with any other program which supports the format. There are windows
programs and apps for mobile phones available. **I highly recommend
to use this backend if you ever intend to store sensitive
information in it!**
## Where to
You can download the source at http://www.daemon.de/NOTE or
https://codeberg.org/scip/note.
If you are using debian, you run `can apt-get ìnstall note`.
If you are using gentoo, you can emerge it.
## Features
* Several different database backends, mysql(DBI), dbm,
binary (bin file), general and text (text files).
* Command line interface using the standard perl module
Getopt::Long, which allows you to use short or long
command-line options.
* Interactive interface (pure ascii), the following functions
are available in interactive mode: list, display, topic,
delete, edit, help.
* Highly configurable using a perlish configfile ~/.noterc.
although it is configurable it is not required, note can
run without a configfile using useful default presets.
* Colourized output is supported using ASCII Escape-Sequences.
* The user can customize the color for each item.
* Data can be stored in various different database backends,
since all database access is excluded from the program itself
in perl modules.
* Notes can be deleted, edited and you can search trough your notes.
* Notes can be categorized. Each category (topic) can contain multiple
notes and even more sup-topics. There is no limitation about
sub topics.
* You can view all notes in a list and it is possible only to view
notes under a certain topic.
* There is a tree-view, which allows you to get an overview of your
topic-hierarchy.
* Notes can be encrypted using DES or IDEA algorithms and Crypt::CBC.
* You can dump the contents of your note database into a plain text
file, which can later be imported. Imports can be appended or it can
overwrite an existing database (`-o`).
* Note has scripting capabilities, you can create a new note by piping
another commands output to note, you can also import a notedump from
stdin as well es duming to stdout instead a file. Additional, there
is an option `--raw` available, which prints everything out completely
without formatting.
* for better performance, note can cache the database for listings
or searching.
* It can be installed without root-privileges.
* If Term::ReadLine (and Term::ReadLine::Gnu) is installed, history
and auto-completion are supported in interactive mode.
* Last, a while ago a user stated: "... it simply does, what it
says ..."
## Requirements
You need the following things:
* perl installed (5.004x)
* The module IO::Seekable and Fcntl, which should be
already installed with your perl distribuion if
you want to use the binary database backend.
* DBI module and DBI::mysql if you want to use the
mysql database backend.
* The module DB_FILE if you want to use the DBM module.
* Getopt::Long (part of perl std distribution)
* Term::ReadLine and optionally Term::ReadLine::Gnu if
you want to use the auto-completion and history functionality.
* Config::General if you want to use the NOTEDB::general
backend.
* YAML is needed to create backups using -D. Please note,
that this format is deprecated starting with 1.4.0.
**The support will be removed in 1.5.0. Please switch to JSON
format as soon as possible, either by using the -j
commandline option or the UseJSON configuration value.**
* The Crypt::PWSafe3 module if you want to use the pwsafe3 backend.
## Installation
Unpack the tar-ball and issue the following command:
`$ perl Makefile.PL`
This creates the Makefile neccessary for installing.
You may add some additional variables to the command line, the
most important one is PREFIX.
Then enter the following command to prepare the installation
process:
`$ make`
After that, you are ready to install. Become root and issue:
`# make install`
The installation process installs all modules for every available
data backends. The default note configuration does not require
additional perl modules.
If you want to use the mysql backend refer to the installation
instructions for the mysql database installation in mysql/README.
If you want to use encryption support, you will need at least
Crypt:CBC and Crypt::Blowfish (or Crypt::DES or whatever you
prefer). You won't need to manually install any of this if you want to
use the pwsafe3 backend, in that case install Crypt::PWSafe3 with all
its dependencies.
## Configuration
This version of note doesn't necessarily need a configuration
file. But you can have one and change some default values. Take a look
at the file config/noterc provided with this tarball. There are
detailed instructions about every available parameter. Simply copy
this file into your home-directory and name it `.noterc` If you decide
not to use the default database backend (a binary file), you will
*need* a configuration!
## Usage
Refer to the note(1) manpage for usage instructions.
## Getting help
Although I'm happy to hear from note users in private email,
that's the best way for me to forget to do something.
In order to report a bug, unexpected behavior, feature requests or to
submit a patch, please open an issue on github:
https://codeberg.org/scip/note/issues.
## Deprecation notes
The **binary** database format will be removed with version 1.5.0. No
deprecation note is being printed for now.
The **text** database format will be either removed or will use
another backend module for security reasons. The perl module Storable
will not be used anymore.
## Copyright and License
Copyright (c) 1999-2013 Thomas Linden
Copyright (c) 2013-2024 Thomas von Dein
Licensed under the GNU GENERAL PUBLIC LICENSE version 3.
You can read the complete GPL at: http://www.gnu.org/copyleft/gpl.html
## Author
T.v.Dein <tom AT vondein DOT org>
## Contributors / Credits
Shouts to all those guys who helped me to enhance note: THANKS A LOT!
Jens Heunemann - sub tree.
Peter Palmreuther - various additions.
And many other people who sent bug reports, feature requests. If you
feel that I forgot your name in this list, then please send me an email
and I'll add you.

View File

@@ -1 +1 @@
1.3.26
1.4.2

222
bin/note
View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl
#
# note - console notes management with database and encryption support.
# Copyright (C) 1999-2017 T.v.Dein (see README for details!)
# Copyright (C) 1999-2024 T.v.Dein (see README for details!)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -17,10 +17,11 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# - Thomas Linden <tom at linden dot at>
# - Thomas von Dein <tom at vondein dot org>
#
# latest version on:
# http://www.daemon.de/note/
# https://codeberg.org/scip/note/
#
use lib qw(blib/lib);
@@ -38,6 +39,7 @@ use Getopt::Long;
use FileHandle;
use File::Spec;
use YAML;
use JSON::PP;
#
@@ -71,11 +73,12 @@ my (
$opt_, $opt_i, $opt_r, $opt_e, $opt_d, $opt_enc,
$opt_s, $opt_t, $opt_T, $opt_l, $opt_L, $opt_c,
$opt_D, $opt_I, $opt_o, $opt_h, $opt_n, $opt_v,
$opt_j, $opt_new,
#
# set from commandline (or interactive)
#
$number, $searchstring, $dump_file, $ImportType, $NewType, $Raw, $TOPIC,
$number, $searchstring, $dump_file, $ImportType, $StdinMode, $Raw, $TOPIC,
#
# configuration options
@@ -121,7 +124,7 @@ my (
'autoclear' => 0,
'maxlen' => 'auto',
'defaultlong' => 0,
'dbdriver' => 'binary',
'dbdriver' => 'binary', # will be depcrecated in 1.5.0 and replaced by dumper.
'timeformat' => 'DD.MM.YYYY hh:mm:ss',
'usecolors' => 0,
'addticket' => 0,
@@ -133,7 +136,8 @@ my (
'printlines' => 0,
'cache' => 0,
'preferrededitor' => '',
'motd' => ''
'motd' => '',
'usejson' => 0, # will be the default in the future
);
# these are not customizable at runtime!
@@ -141,7 +145,7 @@ $hardparams = "(readonly|maxlen|dbdriver|useencryption|cryptmethod)";
$CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
$USER = getlogin || getpwuid($<); chomp $USER;
$TOPIC = 1;
$VERSION = "1.3.26";
$VERSION = "1.4.2";
$CurDepth = 1; # the current depth inside the topic "directory" structure...
$maxlen = "auto";
$timelen = 22;
@@ -196,7 +200,7 @@ if ($ARGV[0] eq "") {
}
elsif ($#ARGV == 0 && $ARGV[0] eq "-") {
$mode = "new";
$NewType = 1; # read from STDIN until EOF
$StdinMode = 1; # read from STDIN until EOF
shift;
undef $has_nothing;
}
@@ -206,6 +210,7 @@ else {
"interactive|i!" => \$opt_i, # no arg
"config|c=s" => \$opt_c, # string, required
"raw|r!" => \$opt_r, # no arg
"new|n:s" => \$opt_new, # no arg or optional string
"edit|e=i" => \$opt_e, # integer, required
"delete|d=s" => \$opt_d, # integer, required
"search|s=s" => \$opt_s, # string, required
@@ -214,21 +219,29 @@ else {
"list|l:s" => \$opt_l, # string, optional
"longlist|L:s" => \$opt_L, # string, optional
"dump|Dump|D:s" => \$opt_D, # string, optional
"json|j" => \$opt_j, # bool, optional
"import|Import|I:s" => \$opt_I, # string, optional
"overwrite|o!" => \$opt_o, # no arg
"help|h|?!" => \$opt_h, # no arg
"version|v!" => \$opt_v, # no arg
"encrypt=s" => \$opt_enc, # string, required
);
$opt_n = shift; # after that @ARGV contains eventually
# a note-number
# $opt_ is a single dash, in case of existence!
);
# after that @ARGV contains eventually a note-number or a single dash
$opt_n = shift;
#
# determine mode
#
if ($opt_i) {
$mode = "interactive";
}
elsif (defined $opt_new) {
$mode = "new";
if ($opt_new eq "-") {
$StdinMode = 1; # read from STDIN
}
}
elsif (defined $opt_l || defined $opt_L) {
$mode = "list";
if (defined $opt_l) {
@@ -276,6 +289,10 @@ else {
else {
$dump_file = "-"; # use STDIN
}
if (defined $opt_j) {
$conf{usejson} = 1; # force JSON
}
}
elsif (defined $opt_I) {
$mode = "import";
@@ -293,7 +310,7 @@ else {
}
}
elsif ($opt_v) {
print "This is note $VERSION by Thomas Linden <tom at linden dot at>.\n";
print "This is note $VERSION by Thomas von Dein <tom at vondein dot org>.\n";
exit(0);
}
elsif ($opt_h) {
@@ -310,18 +327,23 @@ else {
$has_nothing = 1;
}
}
### determine generic options
if ($opt_n =~ /^[\d+\-?\,*]+$/) {
# first arg is a digit!
if ($mode eq "") {
$number = $opt_n;
$mode = "display";
undef $has_nothing;
}
else {
print "mode <$mode> does not take a numerical argument!\n";
exit(1);
}
if ($opt_n =~ /^\d[\d\-?\,]*$/) {
# first arg is a digit!
if ($mode eq "") {
$number = $opt_n;
$mode = "display";
undef $has_nothing;
}
else {
print "mode <$mode> does not take a numerical argument!\n";
exit(1);
}
}
elsif ($opt_n eq "-") {
$StdinMode = 1; # read from STDIN
$mode = "new";
}
elsif ($opt_n ne "") {
print "Unknown option: $opt_n\n";
@@ -343,7 +365,6 @@ if ($has_nothing && $mode eq "") {
&usage;
}
# read the configfile.
$CONF = $opt_c if($opt_c); # if given by commandline, use this.
if (-e $CONF) {
@@ -362,8 +383,8 @@ if ($mode eq "encrypt_passwd") {
exit;
}
# Always interactive?
if ($conf{alwaysinteractive} && $mode ne "dump" && $mode ne "import") {
# Always interactive? with the exception if stdin was requested
if ($conf{alwaysinteractive} && $mode ne "dump" && $mode ne "import" && !$StdinMode && !defined $opt_new) {
$mode = "interactive";
}
@@ -468,7 +489,7 @@ else {
if(scalar keys %all > 0) {
my $id = (keys %all)[0];
if($all{$id}->{date} !~ /^\d+\.\d+?/) {
print "notedb seems to be encrypted!\n";
print "Warning! Encryption is not enabled, but notedb seems to be encrypted or in a non-text binary format. Please check your db file and your config!\n";
exit(1);
}
}
@@ -706,69 +727,75 @@ sub list {
sub new {
my($TEMP,$editor, $date, $note, $WARN, $c, $line, $num, @topic);
if ($conf{readonly}) {
print "readonly\n";
return;
}
$date = &getdate;
return if $db->lock();
if ($conf{alwayseditor}) {
$TEMP = &gettemp;
# security!
unlink $TEMP;
# let the user edit it...
$editor = &find_editor;
if ($editor) {
# create the temp file
open NEW, "> $TEMP" or die "Could not write $TEMP: $!\n";
close NEW;
system "chattr", "+s", $TEMP; # ignore errors, since only on ext2 supported!
system $editor, $TEMP;
}
else {
print "Could not find an editor to use!\n";
$db->unlock();
exit(0);
}
# read it in ($note)
$note = "";
open E, "<$TEMP" or $WARN = 1;
if ($WARN) {
print "...edit process interupted! No note has been saved.\n";
undef $WARN;
$db->unlock();
print "readonly\n";
return;
}
$c = 0;
while (<E>) {
$note = $note . $_;
}
chomp $note;
close E;
# privacy!
unlink $TEMP;
}
$date = &getdate;
$note = "";
$line = "";
return if $db->lock();
if ($StdinMode) {
# create a new note from STDIN
print STDERR "Reading from STDIN ...\n";
while (<STDIN>) {
$note .= $_;
}
}
elsif ($conf{alwayseditor} && &is_interactive()) {
# read a new note interactively or by using the editor
$TEMP = &gettemp;
# security!
unlink $TEMP;
# let the user edit it...
$editor = &find_editor;
if ($editor) {
# create the temp file
open NEW, "> $TEMP" or die "Could not write $TEMP: $!\n";
close NEW;
system "chattr", "+s", $TEMP; # ignore errors, since only on ext2 supported!
system $editor, $TEMP;
}
else {
print "Could not find an editor to use!\n";
$db->unlock();
exit(0);
}
# read it in ($note)
$note = "";
open E, "<$TEMP" or $WARN = 1;
if ($WARN) {
print "...edit process interupted! No note has been saved.\n";
undef $WARN;
$db->unlock();
return;
}
$c = 0;
while (<E>) {
$note = $note . $_;
}
chomp $note;
close E;
# privacy!
unlink $TEMP;
}
else {
$note = "";
$line = "";
# create a new note
if ($NewType) {
# be silent! read from STDIN until EOF.
while (<STDIN>) {
$note .= $_;
}
}
else {
print "enter the text of the note, end with a single .\n";
do
{
do {
$line = <STDIN>;
$note = $note . $line;
} until $line eq ".\n";
} until $line eq ".\n";
# remove the . !
chop $note;
chop $note;
}
}
# look if the note was empty, so don't store it!
if ($note =~ /^\s*$/) {
print "...your note was empty and will not be saved.\n";
@@ -923,6 +950,7 @@ sub edit {
sub dump {
my(%res, $num, $DUMP);
# $dump_file
if ($dump_file eq "-") {
$DUMP = *STDOUT;
@@ -931,8 +959,11 @@ sub dump {
open (DUMPFILE, ">$dump_file") or die "could not open $dump_file\n";
$DUMP = *DUMPFILE;
}
select $DUMP;
%res = $db->get_all();
# FIXME: prepare hashing in NOTEDB class
foreach $num (sort { $a <=> $b } keys %res) {
print STDOUT "dumping note number $num to $dump_file\n" if($dump_file ne "-");
@@ -947,7 +978,17 @@ sub dump {
my $date = $res{$num}->{date};
$res{$num} = { body => $body, title => $title, path => $path, date => $date};
}
print Dump(\%res);
if($conf{usejson}) {
my $json = JSON::PP->new->utf8->pretty;
print $json->encode(\%res);
}
else {
warn "Deprecation notice: YAML export format will not be supported in the future!
Enable JSON using the UseJSON config parameter or the -j commandline parameter!";
print Dump(\%res);
}
close(DUMPFILE);
select STDOUT;
}
@@ -964,9 +1005,16 @@ sub import {
$DUMP = *DUMPFILE;
}
my $yaml = join '', <$DUMP>;
my $serialized = join '', <$DUMP>;
my $res = Load($yaml);
my $res;
if($serialized =~ /^\{/) {
$res = decode_json($serialized);
}
else {
$res = Load($serialized);
}
foreach my $number (keys %{$res}) {
my $note;
@@ -1311,6 +1359,9 @@ Options:
-c, --config file
Use another config file than the default \$HOME/.noterc.
-n, --new
Create a new note entry.
-l, --list [topic]
Lists all existing notes. If no topic were specified, it will
display a list of all existing topics. See the section TOPICS for
@@ -1856,4 +1907,9 @@ sub load_driver {
sub ticket {
return join "", (map { $randomlist[int(rand($#randomlist))] } (0 .. 10) );
}
sub is_interactive {
return -t STDIN && -t STDOUT;
}
__END__

View File

@@ -1,51 +1,47 @@
# note 1.3.13 -*- sh -*-
#
# This is a sample config for the note script
# There are useful defaults set in note itself.
#
# Copy it to your $HOME as .noterc
#
# note is Copyright (c) 1999-2013 Thomas Linden.
# You can contact me per email: <tom at linden dot at>
#
# Comments start with #, empty lines will be ignored.
#
# To turn on an option, set it to: 1, on or yes
# To turn off an option, set it to: 0, off or no
#
# An option consists of an atribute-value pair separated
# by minimum one space (more spaces and/or tabs are allowed)
# and an optional equal sign in between.
#
# Variable names are case in-sensitive.
#
# Refer to the manpage to learn more about the config
# note 1.4.1 -*- conf -*-
#
# This is a sample config for the note script There are useful
# defaults set in note itself.
#
# Copy it to your $HOME as .noterc
#
# Comments start with #, empty lines will be ignored.
#
# To turn on an option, set it to: 1, on or yes
# To turn off an option, set it to: 0, off or no
#
# An option consists of an atribute-value pair separated by minimum
# one space (more spaces and/or tabs are allowed) and an optional
# equal sign in between.
#
# Variable names are case in-sensitive.
#
# Refer to the manpage to learn more about the config
#
# you need to decide which database backend you want
# to use. Please refer to the corresponding documentation
# for closer information about the certain backend!
# Currently supported types: "binary", "dbm", "mysql",
# "general", "dumper", "pwsafe3" or "text".
# You must also edit/uncomment one section below for the
# backend you want to use!
#
# you need to decide which database backend you want to use. Please
# refer to the corresponding documentation for closer information
# about the certain backend! Currently supported types: "binary",
# "dbm", "mysql", "general", "dumper", "pwsafe3" or "text". You must
# also edit/uncomment one section below for the backend you want to
# use!
dbdriver = binary
#
# BINARY backend (the default)
#
# BINARY backend (the default)
binary::dbname = ~/.notedb # filename
binary::MaxNoteByte = 4096 # max bytes per note entry
binary::MaxTimeByte = 64 # max bytes for the date
#
# MYSQL backend
#
# MYSQL backend
mysql::dbhost = localhost # hostname
mysql::dbport = 3306 # tcp port
mysql::dbuser = you # db login
@@ -55,152 +51,146 @@ mysql::encrypt_passwd = 0 # mysql::dbpasswd is
# encrypted (note --encrypt)
#
# DBM backend
dbm::directory = ~/.notedbm # directory
#
# DBM backend
dbm::directory = ~/.notedb.dbm
#
# GENERAL backend
general::dbname = ~/.notedb # filename
#
# GENERAL backend
general::dbname = ~/.notedb.txt
#
# TEXT backend
text::dbname = ~/.notedb # filename
#
# TEXT backend
text::dbname = ~/.notedb.storable
#
# DUMPER backend
dumper::dbname = ~/.notedb # filename
#
# DUMPER backend
dumper::dbname = ~/.notedb.dumper
#
# Password Safe v3 backend
# Some notes on this one:
# This backend maintains encryption itself, which is
# mandatory as well. So you'll have to disable encryption
# (UseEncryption = NO)!
#
# The Password Safe v3 file has its own fields for
# password and username, which note doesn't have. To be
# compatible, the pwsafe3 backend parses the note text
# for those fields and stores them accordignly to the db:
#
# For username field: user|username|login|account|benutzer
# For passwd field: password|pass|passwd|kennwort|pw
#
# If it doesn't find it, it will put empty strings
# into the pwsafe3 database.
#
# The pwsafe3 database can be accessed by Password Safe
# (see: http://passwordsafe.sourceforge.net/) or other
# tools which support the format (see:
# http://passwordsafe.sourceforge.net/relatedprojects.shtml)
pwsafe3::dbname = ~/db.psafe3 # filename
#
# Password Safe v3 backend Some notes on this one: This backend
# maintains encryption itself, which is mandatory as well. So you'll
# have to disable encryption (UseEncryption = NO)!
#
# The Password Safe v3 file has its own fields for password and
# username, which note doesn't have. To be compatible, the pwsafe3
# backend parses the note text for those fields and stores them
# accordignly to the db:
#
# For username field: user|username|login|account|benutzer
# For passwd field: password|pass|passwd|kennwort|pw
#
# If it doesn't find it, it will put empty strings into the pwsafe3
# database.
#
# The pwsafe3 database can be accessed by Password Safe (see:
# http://passwordsafe.sourceforge.net/) or other tools which support
# the format (see:
# http://passwordsafe.sourceforge.net/relatedprojects.shtml)
pwsafe3::dbname = ~/.notedb.psafe3
#
# You can use encryption with note, that means notes and
# timestamps will be stored encrypted. This is supported
# by every db-backend.
#
# You can use encryption with note, that means notes and timestamps
# will be stored encrypted. This is supported by every db-backend, but
# not the pwsafe3 backend because this one has builtin encryption
# support.
UseEncryption = NO
#
# Specify the encryption protocol. The appropriate perl
# module needs to be installed. Possible velues are
# IDEA, DES or Blowfish, the default is IDEA.
#
# Specify the encryption protocol. The appropriate perl module needs
# to be installed. Possible velues are IDEA, DES or Blowfish, the
# default is IDEA.
CryptMethod = IDEA
#
# You can run note always in interactive mode by simply
# typing "note". The default is: YES.
#
# You can run note always in interactive mode by simply
# typing "note". The default is: YES.
AlwaysInteractive = YES
#
# In interactive mode, note issues a list command if you
# simply hit enter. By turning this on, it will issue a
# longlist command instead if you hit just enter.
# The default is: NO
#
# In interactive mode, note issues a list command if you simply hit
# enter. By turning this on, it will issue a longlist command instead
# if you hit just enter. The default is: NO
DefaultLong = NO
#
# You can use an external editor everytime from note instead
# of STDIN for creating new notes. The default is: YES
#
# You can use an external editor everytime from note instead of STDIN
# for creating new notes. The default is: YES
AlwaysEditor = YES
#
# By default, note looks in the environment for a variable
# $EDITOR or, if this is not the case, for $VISUAL and as
# fallback it uses 'vi'.
# You can override this by setting this variable here.
#
# By default, note looks in the environment for a variable $EDITOR or,
# if this is not the case, for $VISUAL and as fallback it uses 'vi'.
# You can override this by setting this variable here.
PreferredEditor =
#
# If you don't prefer that note updates the timestamp of a
# note after editing, turn this on. It will
# keep the original timestamp if this option is set.
# The default is: NO
#
# If you don't prefer that note updates the timestamp of a note after
# editing, turn this on. It will keep the original timestamp if this
# option is set. The default is: NO
KeepTimeStamp = NO
#
# You can specify your own topic separator here.
# The default topic separator is a normal slash: "/"
#
# You can specify your own topic separator here. The default topic
# separator is a normal slash: "/"
TopicSeparator = /
#
# The maximum width for displaying a note, in CHARS.
# Depends on your screen-size. You can set it to
# "auto", if you wish that note should determine the
# available size automatically.
#
# The maximum width for displaying a note, in CHARS. Depends on your
# screen-size. You can set it to "auto", if you wish that note should
# determine the available size automatically.
MaxLen = auto
#
# Turn this off if you dont want note to automatically
# clear the screen after displaying something and after
# exit. The default is: NO
#
# Turn this off if you dont want note to automatically clear the
# screen after displaying something and after exit. The default is: NO
AutoClear = NO
#
# note can use colors for output, turn this of, if
# you don't like it, or if your terminal does
# not support it. The default is: YES
#
# note can use colors for output, turn this of, if you don't like it,
# or if your terminal does not support it. The default is: YES
UseColors = NO
#
# Color-definitions of the various items. Will only
# take effect, if "UseColors" is turned on!
#
# The following colors are available:
# black, red, green, yellow, blue, magenta, cyan and white.
#
# For bold color write it uppercase (BLACK will be bold black).
# For underlined color append an underscore (blue_ will be underlined blue).
# For inverted color append an "I" (greenI will be inverted green).
#
# Color-definitions of the various items. Will only take effect, if
# "UseColors" is turned on!
#
# The following colors are available: black, red, green, yellow, blue,
# magenta, cyan and white.
#
# For bold color write it uppercase (BLACK will be bold black). For
# underlined color append an underscore (blue_ will be underlined
# blue). For inverted color append an "I" (greenI will be inverted
# green).
BorderColor BLACK
NumberColor blue
NoteColor green
@@ -209,84 +199,82 @@ TopicColor BLACK
#
# Additional to colors, you can also do a little bit of formatting your
# notes (bold, underlined, italic) text. The default is: YES.
#
# Additional to colors, you can also do a little bit of formatting
# your notes (bold, underlined, italic) text. The default is: YES.
FormatText = NO
#
# You might specify your own directory for temporary files.
# note needs to create some temp files during editing of notes.
# You could protect this directory using the command: chmod 700 directory.
# The default is: /tmp
#
# You might specify your own directory for temporary files. note
# needs to create some temp files during editing of notes. You could
# protect this directory using the command: chmod 700 directory. The
# default is: /tmp
TempDirectory = ~/tmp
#
# You can jump to a topic by typing "cd 13" in interactive mode.
# The deault is: NO
#
# You can jump to a topic by typing "cd 13" in interactive mode. The
# deault is: NO
ShortCd = YES
#
# note can use a cached copy of the note database for list/tree/search
# this is currently only supported by the binary and the mysql backends,
# the general and text backends have an internal cache.
# The default is: NO
#
# note can use a cached copy of the note database for list/tree/search
# this is currently only supported by the binary and the mysql
# backends, the general and text backends have an internal cache. The
# default is: NO
Cache = NO
#
# You can define your very own time format for time stamps
# YY - the last 2 digits of a year
# YYYY - year
# MM - month
# DD - day
# hh - hours
# mm - minutes
# ss - seconds
# This is the default: (18.10.2000 21:32:08)
#
# You can define your very own time format for time stamps
# YY - the last 2 digits of a year
# YYYY - year
# MM - month
# DD - day
# hh - hours
# mm - minutes
# ss - seconds
# This is the default: (18.10.2000 21:32:08)
TimeFormat = DD.MM.YYYY hh:mm:ss
#
# You can make note readonly which is useful for database copies
# The default is: NO
#
# You can make note readonly which is useful for database copies The
# default is: NO
ReadOnly = NO
#
# Note may separate titles and topics using horizontal lines when
# listing them. You can turn on this behavior by setting
# PrintLines to YES.
# The default is: NO
#
# Note may separate titles and topics using horizontal lines when
# listing them. You can turn on this behavior by setting PrintLines to
# YES. The default is: NO
PrintLines = NO
#
# Add a hash to identify notes. Such a hash will persist several
# importy/export cycles and makes each single note unique.
#
# Add a hash to identify notes. Such a hash will persist several
# importy/export cycles and makes each single note unique.
AddTicket = NO
#
# Show an entry on startup. If you want it, create such an entry
# and supply its number here
#
# Show an entry on startup. If you want it, create such an entry and
# supply its number here
motd =
#
#
# That's all about it for now.
# If you still have any questiosn, please feel free to contact
# me by email: Thomas Linden <tom at linden dot at>
#
#
#
# Enable JSON formatted backups. The option will be removed in version
# 1.5 and become the only available option. In earlier versions: if
# unset or set to NO, YAML will be used.
UseJSON = YES

154
config/rc
View File

@@ -1,154 +0,0 @@
comments start with #, empty lines will be ignored.
1 turns an option on, 0 turns it off.
An option consists of an atribute-value pair separated
by minimum one space (more spaces and/or tabs are allowed)
Your home directory, better do not change it!
can be an environment variable or a path
Home $ENV{'HOME'}
specify the path, where the NOTEDB lib directory
resides. This will only used if it is not
installed inside the perl-lib directory structure!
LibPath /usr/local/lib
you need to decide which database backend you want
to use. Please refer to the corresponding documentation
for closer information about the certain backend!
Currently supported types: "binary", "dbm" or "mysql".
You must also edit/uncomment one section below for the
backend you want to use!
DbDriver binary
backend specific settings for sql backend
DbHost localhost
DbUser you
DbPasswd
DbName mynotes
DbTable note
FieldNumber number
FieldNote note
FieldDate date
use an encrypted password, generate it with note "--encrypt_passwd"
encrypt_passwd 1
#### specific end ###
backend specific settings for binary(default) backend
NoteDb ~/.notedb
Define the maximum bytes fields can have in a
note-entry. Do not change MaxTimeByte to less than 64!
MaxNoteByte 4096
MaxTimeByte 64
#### specific end ###
backend specific settings for DBM backend
this must be an existing directory!
#DbName /home/you/.notedbm
#### specific end ###
You can use encryption with note, that means notes and
timestamps will be stored encrypted. This is supported
by every db-backend.
Set to 1 to turn it on. The Default is 0 (off)
UseEncryption 0
Specify the encryption protocol. The appropriate perl
module needs to be installed. Possible velues are
IDEA, DES or Blowfish, the default is IDEA.
CryptMethod IDEA
You can run note always in interactive mode by simply
typing "note". Set this option to 1 to turn it on.
The default is 0 (off).
AlwaysInteractive 0
In interactive mode, note issues a list command if you
simply hit enter. By turning this on, it will issue a
longlist command instead if you hit just enter.
The default is 0 (off)
DefaultLong 0
You can use an external editor everytime from note instead
of STDIN for creating new notes. Set to 1 to turn it on.
The default is 0 (off).
AlwaysEditor 0
uncomment and edit it, if you want to use another
editor than the default $EDITOR or as fallback vi.
#PreferredEditor emacs
If you dont prefer that note updates the timestamp of a
note after editing, turn this on. It will
keep the original timestamp if this option is set.
The default is 0(off), to turn it on set to 1.
KeepTimeStamp 0
You can specify your own topic separator here.
the default topic separator is a normal slash: "/"
see README for details about topics!
TopicSeparator /
The maximum width for displaying a note, in CHARS.
Depends on your screen-size. You can set it to
"auto", if you wish that note sould determine the
available size, but it experimental, be aware!
MaxLen 30
note can use colors for output, set this option to
1, if you don't want it, or if your terminal does
not support it, set to 0. The default is 1 (on).
UseColors 1
Color-definitions of the various items. Will only
take effect, if "UseColors" is turned on!
BorderColor BLACK
NumberColor blue
NoteColor green
TimeColor black
TopicColor BLACK
The following colors are available:
black, red, green, yellow, blue, magenta, cyan and white.
for bold color write it uppercase (BLACK will be bold black)
for underlined color append an underscore (blue_ will be underlined blue)
for inverted color append an "I" (greenI will be inverted green)
Additional to colors, you can also do a little bit of formatting your
notes (bold, underlined, italic), see README!
You need to set this Option to 1, if you decide to make use of this
capabily
FormatText 1
You might specify your own directory for temporary files.
note needs to create some temp files during editing of notes.
You could protect this directory using the command: chmod 700 directory.
The default is /tmp
TempDirectory /home/you/tmp
You can jump to a topic by typing "cd 13" in interactive mode.
You need to set thi soption to 1 if you want to use this feature.
ShortCd 0
That's all about it for now.
If you still have any questiosn, please feel free to contact
me by email: Thomas Linden <tom@daemon.de>

View File

@@ -0,0 +1,172 @@
#!/usr/bin/perl
use warnings;
use strict;
no strict "refs";
use IO::All;
use Encode;
# only YAML::XS is able to properly load our data (others fail
# invariably)
use YAML::XS qw(Load);
# only YAML is able to properly Dump the data YAML::XS generates
# various kinds of multiline entries like "line\nline2\nline3" end up
# literally in the generated yaml, which note is then unable to
# feed. So, the pure perl version is better as it always generates
# multiline entries for data containing newlines
use YAML qw(Dump);
use Data::Dumper;
use Term::ANSIColor;
my ($yf1, $yf2, $outfile) = @ARGV;
# read both input files and parse yaml into data structure, fix
# non-printables
my $badutf81 < io $yf1;
my $yaml1 = decode( 'UTF-8', $badutf81 =~ s/[^\x00-\x7F]+//gr );
my $y1 = Load $yaml1 or die "Could not load $yf1: $!";
my $badutf82 < io $yf2;
my $yaml2 = decode( 'UTF-8', $badutf82 =~ s/[^\x00-\x7F]+//gr );
my $y2 = Load $yaml2 or die "Could not load $yf2: $!";
# convert to comparable hashes with unique keys
my $hash1 = &hashify($y1);
my $hash2 = &hashify($y2);
# diff and recombine the two into a new one
my $combinedhash = &hash2note(&diff($hash1, $hash2));
#print Dumper($combinedhash); exit;
# turn into yaml
my $combindedyaml = Dump($combinedhash);
# perl uses scalars as hash keys (read: strings) so we need to unquote
# them here to make note happy
$combindedyaml =~ s/^'(\d+)':/$1:/gm;
# done
my $out = io $outfile;
$combindedyaml > $out;
print "\nDone. Wrote combined hashes to $outfile\n";
sub hash2note {
# convert given hash into note format with number as key
my $hash = shift;
my $new;
my $i = 0;
foreach my $path (sort keys %{$hash}) {
$new->{++$i} = $hash->{$path};
}
return $new;
}
sub diff {
# diff the two hashes, create a new combined one
my($hash1, $hash2) = @_;
my $new;
# iterate over hash1, store duplicates and remove them in hash2,
# store different entries and remove in both,
# store those missing in hash2 and delete them in hash1
foreach my $path (sort keys %{$hash1}) {
if (exists $hash2->{$path}) {
if ($hash2->{$path}->{body} eq $hash1->{$path}->{body}) {
#printf STDERR "%s => %s is duplicate\n", $path, $hash1->{$path}->{title};
$new->{$path} = delete $hash2->{$path};
delete $hash1->{$path};
}
else {
printf STDERR "%s => %s is different\n", $path, $hash1->{$path}->{title};
my $which = &askdiff($hash1->{$path}->{body}, $hash2->{$path}->{body}, $hash1->{$path}->{title});
if ($which eq 'l') {
# use left
$new->{$path} = delete $hash1->{$path};
delete $hash2->{$path};
}
elsif ($which eq 'r') {
# use right
$new->{$path} = delete $hash2->{$path};
delete $hash1->{$path};
}
else {
# both
$new->{$path} = delete $hash1->{$path};
$new->{$path . 2} = delete $hash2->{$path};
}
}
}
else {
#printf STDERR "%s => %s is missing in hash2\n", $path, $hash1->{$path}->{title};
$new->{$path} = delete $hash1->{$path};
}
}
# store any lefovers of hash1
foreach my $path (sort keys %{$hash1}) {
#printf STDERR "%s => %s is left in hash1\n", $path, $hash1->{$path}->{title};
$new->{$path} = $hash1->{$path};
}
# store any lefovers of hash2
foreach my $path (sort keys %{$hash2}) {
#printf STDERR "%s => %s is left in hash2\n", $path, $hash2->{$path}->{title};
$new->{$path} = $hash2->{$path};
}
return $new
}
sub askdiff {
my ($left, $right, $title) = @_;
$left > io("/tmp/$$-body-left");
$right > io("/tmp/$$-body-right");
my $diff = `diff --side-by-side /tmp/$$-body-left /tmp/$$-body-right`;
print color ('bold');
print "\n\nEntry $title exists in both hashes but differ. Diff:\n";
print color ('reset');
print "$diff\n";
print color ('bold');
print "keep [l]eft, keep [r]ight, keep [b]oth? ";
print color ('reset');
my $answer = <STDIN>;
chomp $answer;
system("rm -f /tmp/$$-body-left /tmp/$$-body-right");
if ($answer !~ /^[blr]$/) {
print "Wrong answer $answer, using [b]oth!\n";
return 'b';
}
return $answer;
}
sub hashify {
# create new hash with path+title as key instead of id's
my $data = shift;
my $new = {};
foreach my $id (keys %{$data} ) {
my $path = $data->{$id}->{path} . '|' . $data->{$id}->{title};
if (exists $new->{$path}) {
die "$path already exists!\n";
}
else {
$new->{$path} = $data->{$id};
}
}
return $new;
}

View File

@@ -1,7 +1,7 @@
perl modules for note used as database backends.
the install.sh script will install both of them,
although you may only need one backend. Perhaps
other users on your system have oter ideas in mind...
other users on your system have other ideas in mind...
Therefore, please ignore these file. There is nothing
to edit or to do. Simply leave this directory :-)

View File

@@ -5,7 +5,7 @@
#
package NOTEDB::binary;
$NOTEDB::binary::VERSION = "1.12";
$NOTEDB::binary::VERSION = "1.13";
use strict;
use IO::Seekable;
@@ -451,7 +451,7 @@ NOTEDB::binary - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
@@ -481,7 +481,7 @@ However, both versions provides identical interfaces, which means, you do
not need to change your code, if you want to switch to another database format.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -6,7 +6,7 @@
package NOTEDB::dbm;
$NOTEDB::dbm::VERSION = "1.41";
$NOTEDB::dbm::VERSION = "1.42";
use DB_File;
use NOTEDB;
@@ -29,7 +29,7 @@ sub new
my $notefile = "note.dbm";
my $timefile = "date.dbm";
my $dbm_dir = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".note_dbm");
my $dbm_dir = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb.dbm");
if (! -d $dbm_dir) {
# try to make it
@@ -230,12 +230,12 @@ NOTEDB::dbm - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
# recount all noteids starting by 1 (usefull after deleting one!)
# recount all noteids starting by 1 (useful after deleting one!)
$db->set_recountnums();
# modify a certain note
@@ -253,7 +253,7 @@ You can use this module for accessing a note database. This is the dbm module.
It uses the DB_FILE module to store it's data and it uses DBM files for tis purpose.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -4,7 +4,7 @@
package NOTEDB::dumper;
$NOTEDB::dumper::VERSION = "1.02";
$NOTEDB::dumper::VERSION = "1.03";
use strict;
use Data::Dumper;
@@ -29,7 +29,7 @@ sub new {
my $self = {};
bless($self,$class);
$self->{NOTEDB} = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb");
$self->{NOTEDB} = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb.dumper");
if(! -e $param{dbname}) {
open(TT,">$param{dbname}") or die "Could not create $param{dbname}: $!\n";
@@ -329,7 +329,7 @@ NOTEDB::text - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
@@ -356,7 +356,7 @@ You can use this module for accessing a note database. This backend uses
a text file for storage and Storable for accessing the file.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -4,7 +4,7 @@
package NOTEDB::general;
$NOTEDB::general::VERSION = "1.04";
$NOTEDB::general::VERSION = "1.05";
use strict;
#use Data::Dumper;
@@ -31,7 +31,7 @@ sub new {
my $self = {};
bless($self,$class);
$self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb");
$self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb.txt");
if(! -e $param{dbname}) {
open(TT,">$param{dbname}") or die "Could not create $param{dbname}: $!\n";
@@ -370,7 +370,7 @@ NOTEDB::general - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
@@ -397,7 +397,7 @@ You can use this module for accessing a note database. This backend uses
a text file for storage and Config::General for accessing the file.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -377,12 +377,12 @@ NOTEDB::mysql - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
# recount all noteids starting by 1 (usefull after deleting one!)
# recount all noteids starting by 1 (useful after deleting one!)
$db->set_recountnums();
# modify a certain note
@@ -409,7 +409,7 @@ However, both versions provides identical interfaces, which means, you do
not need to change your code, if you want to switch to another database format.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -3,7 +3,7 @@
package NOTEDB::pwsafe3;
$NOTEDB::pwsafe3::VERSION = "1.08";
$NOTEDB::pwsafe3::VERSION = "1.09";
use strict;
use Data::Dumper;
use Time::Local;
@@ -28,7 +28,7 @@ sub new {
my $self = {};
bless($self,$class);
$self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb");
$self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb.psafe3");
$self->{mtime} = $self->get_stat();
$self->{unread} = 1;
@@ -568,7 +568,7 @@ NOTEDB::pwsafe3 - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
@@ -595,7 +595,7 @@ You can use this module for accessing a note database. This backend uses
a text file for storage and Config::General for accessing the file.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -4,7 +4,7 @@
package NOTEDB::text;
$NOTEDB::text::VERSION = "1.04";
$NOTEDB::text::VERSION = "1.05";
use strict;
#use Data::Dumper;
@@ -30,7 +30,7 @@ sub new {
my $self = {};
bless($self,$class);
$self->{NOTEDB} = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb");
$self->{NOTEDB} = $self->{dbname} = $param{dbname} || File::Spec->catfile($ENV{HOME}, ".notedb.storable");
if(! -e $param{dbname}) {
open(TT,">$param{dbname}") or die "Could not create $param{dbname}: $!\n";
@@ -310,7 +310,7 @@ NOTEDB::text - module lib for accessing a notedb from perl
# get all existing notes
%all_notes = $db->get_all();
# format of returnes hash like the one from get_search above
# format of returns hash like the one from get_search above
# get the next noteid available
$next_num = $db->get_nextnum();
@@ -337,7 +337,7 @@ You can use this module for accessing a note database. This backend uses
a text file for storage and Storable for accessing the file.
Currently, NOTEDB module is only used by note itself. But feel free to use it
within your own project! Perhaps someone want to implement a webinterface to
within your own project! Perhaps someone want to implement a web interface to
note...
=head1 USAGE

View File

@@ -12,14 +12,15 @@ note [options] [ number [,number...]]
=head1 DESCRIPTION
B<note> is a small console program written in perl, which allows
you to manage notes similar to programs like "knotes" but from
the commandline. Note can use different database-backends for
notes-storage. It ships with a DBI-based mysql-module(which
can also be used for other by DBI supported DBMS), another
module, which uses a binary file for storage and a DBM module.
There are also two modules available which uses a text file.
Note supports since version 1.0.0 encryption(IDEA or DES)!
B<note> is a small console program written in perl, which allows you
to manage notes similar to programs like "knotes" but from the command
line. Note can use different database-backends for notes-storage. It
ships with a DBI-based mysql-module(which can also be used for other
by DBI supported DBMS), another module, which uses a binary file for
storage and a DBM module. There are also two modules available which
uses a text file. Note supports since version 1.0.0 encryption(IDEA
or DES)! And last but not least the PWSafe3 format is also supported
by the pwsafe3 backend, which is encrypted by default.
=head1 OPTIONS
@@ -31,6 +32,9 @@ Note supports since version 1.0.0 encryption(IDEA or DES)!
Use another config file than the default ~/.noterc.
=item I<-n, --new>
Create a new note entry.
=item I<-l, --list [topic]>
@@ -77,6 +81,10 @@ the specified ones.
Dumps all notes to the textfile <file>. If <file> is a "-" it will
be printed out to standard output (STDOUT).
=item I<-j --json>
Use JSON format for exports created using -D. The importer determines
the format to be used automatically.
=item I<-I, --Import file | ->
@@ -108,7 +116,7 @@ for details on this mode.
=item I<--encrypt cleartext>
Encrypt the given clear text string. You would need that if you want to
store the mysql password not in cleartext in the config(if you are using
store the mysql password not in cleartext in the config (if you are using
the mysql backend!).
@@ -140,7 +148,7 @@ note from STDIN until EOF. This makes it possible to pipe text into a new note,
=head2 GENERAL USAGE
If you don't know, how to run note, try "note -h" first.
It will tell you all available commandline options.
It will tell you all available command line options.
To create a new note, simply run "note". You can enter
the note (the length is by default limited to 4096 bytes,
@@ -188,7 +196,7 @@ To delete note 1,2 and 3, use "-d 1-3".
If you cannot remember, which note you are looking for, you
can use the search capability of note: "note -s <searchstring>".
note will search the whole note database case insensitive for
an occurence of this string and tell you the number and first-
an occurrence of this string and tell you the number and first-
line it has.
You can extend the searchstring using B<AND>, B<OR> ( and ) and
@@ -206,9 +214,9 @@ display it's second line.
These rules apply for the interactive search too.
You need to know, that note searches for the expression in every
note. In other words, "moses AND lenin" searches for an occurence
note. In other words, "moses AND lenin" searches for an occurrence
of "moses" and "lenin" in ONE note. Or, if you are looking for
"mike OR daniel", then it searches for an occurence of "mike" or
"mike OR daniel", then it searches for an occurrence of "mike" or
daniel" in ONE note. Thus a note with the text "mike oldfield" will
match that search.
@@ -288,7 +296,7 @@ topic. You will get strange results without it!
=head2 INTERACTIVE MODE
If you start note with the commandline flag B<-i>, then it starts
If you start note with the command line flag B<-i>, then it starts
with an interactive interface.
It will start with a listing under the default top-topic ("/").
You can enter the name of a topic to change to that topic. This works
@@ -316,8 +324,8 @@ You can achieve the same result by simply pressing enter at any time.
You can create a new note by simply pressing B<N> or B<n>. You favorite
editor will be started and you can enter your note text. If you are already
under a topic then this new note will automatically go to this topic.
note adds an aditional line to the top of the note with the topic. But
you can of course specify your own topic.
note adds an additional line to the top of the note with the topic. But
you can, of course, specify your own topic.
Note will tell you which number it has assigned to the newly created note.
@@ -338,7 +346,7 @@ Say if you delete 1 and 2, then 3 will become 1, 4 will become 5 and so forth.
=item B<S [expression]>
You can search for the occurence of a text in your notes-database with the
You can search for the occurrence of a text in your notes-database with the
command B<S> or B<s>. If you omit an expression note will ask you for one.
If your search criteria matches on exactly one entry, note will display
@@ -393,14 +401,14 @@ Quit note.
You can also dump the contents of your note-database into a
ASCII-textfile(I<-D>). You can use this file later to import it into
your note-database(-I). This is usefull, if you want quickly trans-
your note-database(-I). This is useful, if you want quickly trans-
fer your notes from one host to another (i.e. you could mail
your note-dump form your office to home and import it there
for further use).
The dumps from the two versions of note are in the same format.
Using dumps it is also possible to reinitialize your database. You
can use the "-o" switch whcih causes note to overwrite your existing
can use the "-o" switch which causes note to overwrite your existing
database. This is very handy if you changed heavily your config. And
it is required, if you changed: encryption, db-driver, (binary-format)
and the password. You can use the following command for reinitializing:
@@ -414,7 +422,7 @@ What the hell, does this do?! Step by step:
=item *
B<note -D -> creates a note-database dump and prints it out
to stantdard output.
to standard output.
=item *
@@ -466,8 +474,8 @@ character. Here are the available things, you can do:
The text will be formatted using the actually note-color.
The hidden formatting will use blue forground and blue background
to hide a string from the terminal, which is usefull for passwords.
The hidden formatting will use blue foreground and blue background
to hide a string from the terminal, which is useful for passwords.
If you set "FormatText" to I<simple> then the formatting can be
done this way instead:
@@ -495,7 +503,7 @@ Crypt::DES
Crypt::CBC
After turning on encryption, note will ask you for a passphrase
everytime it runs! It will *not* store this passphrase!
every time it runs! It will *not* store this passphrase!
So, don't forget it! Be careful!
@@ -507,7 +515,7 @@ You can use a configuration file with note but it is not required.
Note will use default values if there is no config.
The default config file is B<~/.noterc>. You may specify another
one with the commandline flag I<--config>.
one with the command line flag I<--config>.
Comments start with #, empty lines will be ignored.
@@ -534,6 +542,6 @@ T.v.Dein <tlinden@cpan.org>
=head1 VERSION
1.3.20
1.4.0
=cut