Squashed commit of the following:
commit ac9da4ef336ed4a7d65196261b5ef35132c2fa5c Author: Ingolf Wagner <contact@ingolf-wagner.de> Date: Mon Jun 19 22:14:28 2017 +0200 update README commit3ae146424a
Author: Ingolf Wagner <contact@ingolf-wagner.de> Date: Mon Jun 19 22:04:52 2017 +0200 add man page commit68d49fda1c
Author: Ingolf Wagner <contact@ingolf-wagner.de> Date: Thu Jun 15 23:18:34 2017 +0200 add can read from input now #4
This commit is contained in:
parent
4831c14651
commit
132e10d9bb
15
README.md
15
README.md
|
@ -1,11 +1,14 @@
|
||||||
# memo
|
# memo
|
||||||
|
|
||||||
A simple memo tool written in bash.
|
A simple tool written in bash to memorize stuff.
|
||||||
|
|
||||||
Memo are organized in topic which are folders in `~/memo`
|
Memo organizes is structured through topics which are folders in `~/memo`.
|
||||||
|
|
||||||
You can copy file to you topic and you can search across all your
|
## Features
|
||||||
topics.
|
|
||||||
|
* add text to a topic to memorize it
|
||||||
|
* search for strings in your memo-database
|
||||||
|
* copy/import files to topic folder.
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
|
@ -22,10 +25,8 @@ topics.
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
to change the folder where the memo files are kept just add
|
to change the folder where memo kept its files just add
|
||||||
|
|
||||||
export MEMO_DIR=/path/to/memo/folder
|
export MEMO_DIR=/path/to/memo/folder
|
||||||
|
|
||||||
in your `~/.bashrc`.
|
in your `~/.bashrc`.
|
||||||
|
|
||||||
|
|
||||||
|
|
86
doc/memo.1
Normal file
86
doc/memo.1
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
.\" Text automatically generated by txt2man
|
||||||
|
.TH memo 1 "19 June 2017" "doc" "Linux Reference Manual"
|
||||||
|
.SH NAME
|
||||||
|
\fBmemo
|
||||||
|
\fB
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.nf
|
||||||
|
.fam C
|
||||||
|
\fBmemo\fP <command> [\fIarguments\fP]
|
||||||
|
|
||||||
|
.fam T
|
||||||
|
.fi
|
||||||
|
.fam T
|
||||||
|
.fi
|
||||||
|
.SH DESCRIPTION
|
||||||
|
A tool to memorize stuff.
|
||||||
|
It saves files $MEMO_DIR ($HOME/\fBmemo\fP by default).
|
||||||
|
The structure is $MEMO_DIR/<topic>/memo.md
|
||||||
|
You can also copy files in the topic folder as well.
|
||||||
|
.PP
|
||||||
|
We call the folder $MEMO_DIR/<topic> a 'topic folder'.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.SH COMMANDS
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
add <topic> [text]
|
||||||
|
adds text to the memo.md in the topic folder.
|
||||||
|
if text is not given it will read from stdin.
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
copy <topic> <file-to-copy>
|
||||||
|
copy a file to the topic folder.
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
search <term-to-search>
|
||||||
|
search for a term in $MEMO_DIR using ack.
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
show <topic>
|
||||||
|
shows memo.md in the topic folder.
|
||||||
|
also showes a list of all files in the topic folder
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
list
|
||||||
|
prints a list of all topics.
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.SH CONFIGURATION
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B
|
||||||
|
$MEMO_DIR
|
||||||
|
holds the folder where to store the \fBmemo\fP files.
|
||||||
|
Default is $HOME/\fBmemo\fP
|
||||||
|
.SH EXAMPLE
|
||||||
|
|
||||||
|
|
||||||
|
Append the string "A search-engine" to the memo.md file
|
||||||
|
in the topic "google".
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
.fam C
|
||||||
|
$> memo add google A search-engine
|
||||||
|
|
||||||
|
.fam T
|
||||||
|
.fi
|
||||||
|
Appends the content of "www.google.com" to the memo.md file
|
||||||
|
the topic "google".
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
.fam C
|
||||||
|
$> curl www.google.com | memo add google
|
||||||
|
|
||||||
|
.fam T
|
||||||
|
.fi
|
||||||
|
Copy the "Invoice.pdf" file to the "lawsuit" topic.
|
||||||
|
.PP
|
||||||
|
.nf
|
||||||
|
.fam C
|
||||||
|
$> memo copy lawsuit ~/Downloads/Invoice.pdf
|
||||||
|
|
||||||
|
|
||||||
|
|
53
doc/memo.txt
Normal file
53
doc/memo.txt
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
NAME
|
||||||
|
memo
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
memo <command> [arguments]
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
A tool to memorize stuff.
|
||||||
|
It saves files $MEMO_DIR ($HOME/memo by default).
|
||||||
|
The structure is $MEMO_DIR/<topic>/memo.md
|
||||||
|
You can also copy files in the topic folder as well.
|
||||||
|
|
||||||
|
We call the folder $MEMO_DIR/<topic> a 'topic folder'.
|
||||||
|
|
||||||
|
|
||||||
|
COMMANDS
|
||||||
|
add <topic> [text] adds text to the memo.md in the topic folder.
|
||||||
|
if text is not given it will read from stdin.
|
||||||
|
|
||||||
|
copy <topic> <file-to-copy> copy a file to the topic folder.
|
||||||
|
|
||||||
|
search <term-to-search> search for a term in $MEMO_DIR using ack.
|
||||||
|
|
||||||
|
show <topic> shows memo.md in the topic folder.
|
||||||
|
also showes a list of all files in the topic folder
|
||||||
|
|
||||||
|
list prints a list of all topics.
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURATION
|
||||||
|
|
||||||
|
$MEMO_DIR holds the folder where to store the memo files.
|
||||||
|
Default is $HOME/memo
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
|
||||||
|
|
||||||
|
Append the string "A search-engine" to the memo.md file
|
||||||
|
in the topic "google".
|
||||||
|
|
||||||
|
$> memo add google A search-engine
|
||||||
|
|
||||||
|
Appends the content of "www.google.com" to the memo.md file
|
||||||
|
the topic "google".
|
||||||
|
|
||||||
|
$> curl www.google.com | memo add google
|
||||||
|
|
||||||
|
Copy the "Invoice.pdf" file to the "lawsuit" topic.
|
||||||
|
|
||||||
|
$> memo copy lawsuit ~/Downloads/Invoice.pdf
|
||||||
|
|
||||||
|
|
||||||
|
|
22
memo
22
memo
|
@ -37,17 +37,24 @@ function precondition::provide_topic(){
|
||||||
|
|
||||||
function add_memo(){
|
function add_memo(){
|
||||||
topic_name=$1
|
topic_name=$1
|
||||||
shift
|
|
||||||
memo=$@
|
|
||||||
|
|
||||||
precondition::provide_topic ${topic_name}
|
precondition::provide_topic ${topic_name}
|
||||||
|
|
||||||
topic_path=${MEMO_FOLDER}/${topic_name}
|
topic_path=${MEMO_FOLDER}/${topic_name}
|
||||||
echo "append memo to ${topic_name}"
|
|
||||||
cat >>${topic_path}/memo.md <<EOF
|
shift
|
||||||
|
if [[ $# -gt 0 ]]
|
||||||
|
then
|
||||||
|
memo=$@
|
||||||
|
echo "append memo to ${topic_name}"
|
||||||
|
cat >>${topic_path}/memo.md <<EOF
|
||||||
|
|
||||||
${memo}
|
${memo}
|
||||||
EOF
|
EOF
|
||||||
|
else
|
||||||
|
echo "append input to ${topic_name}"
|
||||||
|
echo "" >>${topic_path}/memo.md
|
||||||
|
cat >>${topic_path}/memo.md -
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,6 +179,9 @@ Commands:
|
||||||
add <topic> [memo]
|
add <topic> [memo]
|
||||||
adds a memo.md in ${MEMO_FOLDER}/<topic>/
|
adds a memo.md in ${MEMO_FOLDER}/<topic>/
|
||||||
containing the text
|
containing the text
|
||||||
|
if memo is not given it will read from input
|
||||||
|
so piping is possible.
|
||||||
|
Example: cat file.txt | memo add topic
|
||||||
|
|
||||||
copy <topic> <file to copy>
|
copy <topic> <file to copy>
|
||||||
copy a file to ${MEMO_FOLDER}/<topic>/
|
copy a file to ${MEMO_FOLDER}/<topic>/
|
||||||
|
|
Loading…
Reference in a new issue