Merge branch 'release/0.7'

master 0.7
Ingolf Wagner 2018-12-31 02:53:40 +01:00
commit 6b8139927e
5 changed files with 183 additions and 163 deletions

View File

@ -1,112 +1,111 @@
.\" Text automatically generated by txt2man .\" Automatically generated by Pandoc 2.2.1
.TH memo 1 "10 August 2018" "doc" "Linux Reference Manual" .\"
.TH "memo" "1" "10 August 2018" "doc" "Linux Reference Manual"
.hy
.SH NAME .SH NAME
\fBmemo .PP
\fB memo
.SH SYNOPSIS .SH SYNOPSIS
.nf .PP
.fam C \f[C]memo\ <command>\ [arguments]\f[]
\fBmemo\fP <command> [\fIarguments\fP]
.fam T
.fi
.fam T
.fi
.SH DESCRIPTION .SH DESCRIPTION
.PP
A tool to memorize stuff. A tool to memorize stuff.
It saves files $MEMO_DIR ($HOME/\fBmemo\fP by default). It saves files \f[C]$MEMO_DIR\f[] (\f[C]$HOME/memo\f[] by default).
The structure is $MEMO_DIR/<topic>/memo.md The structure is \f[C]$MEMO_DIR/<topic>/memo.md\f[] You can also copy
You can also copy files in the topic folder as well. files in the topic folder as well.
.PP .PP
We call the folder $MEMO_DIR/<topic> a 'topic folder'. We call the folder \f[C]$MEMO_DIR/<topic>\f[] a `topic folder'.
.RE
.PP
.SH COMMANDS .SH COMMANDS
.TP .TP
.B .B \f[C]add\ <topic>\ [text]\f[]
add <topic> [text] Adds text to the \f[C]memo.md\f[] in the topic folder.
adds text to the memo.md in the topic folder. If text is not given it will read from stdin.
if text is not given it will read from stdin. .RS
.TP .RE
.B .TP
rm <topic> .B \f[C]rm\ <topic>\f[]
remove $MEMO_DIR/topic folder with all it's content. Remove \f[C]$MEMO_DIR/topic\f[] folder with all its content.
.TP .RS
.B .RE
copy <topic> <file-to-copy> .TP
copy a file to the topic folder. .B \f[C]copy\ <topic>\ <file\-to\-copy>\f[]
.TP Copy a file to the topic folder.
.B .RS
search <term-to-search> .RE
search for a term in $MEMO_DIR using ack. .TP
.TP .B \f[C]search\ <term\-to\-search>\f[]
.B Search for a term in \f[C]$MEMO_DIR\f[] using \f[C]ack\f[].
show <topic> .RS
shows memo.md in the topic folder. .RE
also showes a list of all files in the topic folder .TP
.TP .B \f[C]show\ <topic>\f[]
.B Shows \f[C]memo.md\f[] in the topic folder.
edit <topic> Also shows a list of all files in the topic folder.
opens your favorite editor to edit the \fBmemo\fP topic .RS
.TP .RE
.B .TP
list .B \f[C]edit\ <topic>\f[]
prints a list of all topics. Opens your favorite editor to edit the memo topic.
.TP .RS
.B .RE
git <command> .TP
run git command in $MEMO_DIR. .B \f[C]list\f[]
Once $MEMO_DIR is a git repository all \fBmemo\fP commands create commits. Prints a list of all topics.
.RS
.RE
.TP
.B \f[C]git\ <command>\f[]
Run a git command in \f[C]$MEMO_DIR\f[].
Once \f[C]$MEMO_DIR\f[] is a git repository, all memo commands create
commits.
.RS
.RE .RE
.PP
.SH CONFIGURATION .SH CONFIGURATION
.TP .TP
.B .B \f[C]$MEMO_DIR\f[]
$MEMO_DIR holds the folder where to store the memo files.
holds the folder where to store the \fBmemo\fP files. Default is \f[C]$HOME/memo\f[].
Default is $HOME/\fBmemo\fP .RS
.RE
.TP .TP
.B .B \f[C]$EDITOR\f[]
$EDITOR Your favorite editor.
Your favorite editor. Must be set for the edit command Must be set for the edit command.
.RS
.RE
.SH EXAMPLE .SH EXAMPLE
Append the string "A search-engine" to the memo.md file
in the topic "google".
.PP .PP
Append the string \[lq]A search\-engine\[rq] to the \f[C]memo.md\f[]
file in the topic \[lq]google\[rq].
.IP
.nf .nf
.fam C \f[C]
$> memo add google A search-engine $\ memo\ add\ google\ A\ search\-engine
\f[]
.fam T
.fi .fi
Appends the content of "www.google.com" to the memo.md file
the topic "google".
.PP .PP
Appends the content of \f[C]www.google.com\f[] to the \f[C]memo.md\f[]
file the topic \[lq]google\[rq].
.IP
.nf .nf
.fam C \f[C]
$> curl www.google.com | memo add google $\ curl\ www.google.com\ |\ memo\ add\ google
\f[]
.fam T
.fi .fi
Copy the "Invoice.pdf" file to the "lawsuit" topic.
.PP .PP
Copy the \[lq]Invoice.pdf\[rq] file to the \[lq]lawsuit\[rq] topic.
.IP
.nf .nf
.fam C \f[C]
$> memo copy lawsuit ~/Downloads/Invoice.pdf $\ memo\ copy\ lawsuit\ ~/Downloads/Invoice.pdf
\f[]
.fam T
.fi .fi
Make $MEMO_DIR a git repository.
.PP .PP
Make \f[C]$MEMO_DIR\f[] a git repository.
.IP
.nf .nf
.fam C \f[C]
$> memo git init $\ memo\ git\ init
\f[]
.fi

75
doc/memo.1.md Normal file
View File

@ -0,0 +1,75 @@
---
title: memo
date: 10 August 2018
header: Linux Reference Manual
footer: doc
section: 1
...
# 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.
`rm <topic>`
: Remove `$MEMO_DIR/topic` folder with all its content.
`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 shows a list of all files in the topic folder.
`edit <topic>`
: Opens your favorite editor to edit the memo topic.
`list`
: Prints a list of all topics.
`git <command>`
: Run a git command in `$MEMO_DIR`. Once `$MEMO_DIR` is a git repository, all memo commands create commits.
# CONFIGURATION
`$MEMO_DIR`
: holds the folder where to store the memo files. Default is `$HOME/memo`.
`$EDITOR`
: Your favorite editor. Must be set for the edit command.
# 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
Make `$MEMO_DIR` a git repository.
$ memo git init

View File

@ -1,67 +0,0 @@
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.
rm <topic> remove $MEMO_DIR/topic folder with all it's content.
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
edit <topic> opens your favorite editor to edit the memo topic
list prints a list of all topics.
git <command> run git command in $MEMO_DIR.
Once $MEMO_DIR is a git repository all memo commands create commits.
CONFIGURATION
$MEMO_DIR holds the folder where to store the memo files.
Default is $HOME/memo
$EDITOR Your favorite editor. Must be set for the edit command
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
Make $MEMO_DIR a git repository.
$> memo git init

14
memo
View File

@ -18,7 +18,7 @@ pandoc_cmd=pandoc
MEMO_FOLDER="${MEMO_DIR:-$HOME/memo}" MEMO_FOLDER="${MEMO_DIR:-$HOME/memo}"
function precondition::provide_memo_folder(){ function precondition:provide_memo_folder(){
if [[ ! -d ${MEMO_FOLDER} ]] if [[ ! -d ${MEMO_FOLDER} ]]
then then
echo "create memo folder : ${MEMO_FOLDER}" echo "create memo folder : ${MEMO_FOLDER}"
@ -26,7 +26,7 @@ function precondition::provide_memo_folder(){
fi fi
} }
function precondition::provide_topic(){ function precondition:provide_topic(){
topic_name=$1 topic_name=$1
topic_path=${MEMO_FOLDER}/${topic_name} topic_path=${MEMO_FOLDER}/${topic_name}
topic_file=${topic_path}/memo.md topic_file=${topic_path}/memo.md
@ -88,7 +88,7 @@ function git:run_command(){
function remove_topic (){ function remove_topic (){
topic_name=$1 topic_name=$1
#precondition::provide_topic ${topic_name} #precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name} topic_path=${MEMO_FOLDER}/${topic_name}
if [[ -d ${topic_path} ]] if [[ -d ${topic_path} ]]
@ -106,7 +106,7 @@ function remove_topic (){
function edit_topic () { function edit_topic () {
topic_name=$1 topic_name=$1
precondition::provide_topic ${topic_name} precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name} topic_path=${MEMO_FOLDER}/${topic_name}
if [[ -z ${EDITOR} ]] if [[ -z ${EDITOR} ]]
@ -127,7 +127,7 @@ function edit_topic () {
function add_memo(){ function add_memo(){
topic_name=$1 topic_name=$1
precondition::provide_topic ${topic_name} precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name} topic_path=${MEMO_FOLDER}/${topic_name}
topic_file=${topic_path}/memo.md topic_file=${topic_path}/memo.md
@ -178,7 +178,7 @@ function copy_file(){
exit 1 exit 1
fi fi
precondition::provide_topic ${topic_name} precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name} topic_path=${MEMO_FOLDER}/${topic_name}
echo "copy '${path}' to '${topic_name}'" echo "copy '${path}' to '${topic_name}'"
@ -328,7 +328,7 @@ EOF
command=$1 command=$1
shift shift
precondition::provide_memo_folder precondition:provide_memo_folder
git:status git:status
case $command in case $command in

13
shell.nix Normal file
View File

@ -0,0 +1,13 @@
{ pkgs ? import <nixpkgs> {} }:
let manPath = doc/memo.1;
in pkgs.stdenv.mkDerivation {
name = "memo";
buildInputs = [
(pkgs.writeShellScriptBin "make-man" ''
${pkgs.pandoc}/bin/pandoc --standalone --to man -o ${toString manPath} doc/memo.1.md
'')
(pkgs.writeShellScriptBin "view-man" ''
${pkgs.man-db}/bin/man ${toString manPath}
'')
];
}