Merge branch 'release/0.7'

This commit is contained in:
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
.TH memo 1 "10 August 2018" "doc" "Linux Reference Manual"
.\" Automatically generated by Pandoc 2.2.1
.\"
.TH "memo" "1" "10 August 2018" "doc" "Linux Reference Manual"
.hy
.SH NAME
\fBmemo
\fB
.PP
memo
.SH SYNOPSIS
.nf
.fam C
\fBmemo\fP <command> [\fIarguments\fP]
.fam T
.fi
.fam T
.fi
.PP
\f[C]memo\ <command>\ [arguments]\f[]
.SH DESCRIPTION
.PP
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.
It saves files \f[C]$MEMO_DIR\f[] (\f[C]$HOME/memo\f[] by default).
The structure is \f[C]$MEMO_DIR/<topic>/memo.md\f[] You can also copy
files in the topic folder as well.
.PP
We call the folder $MEMO_DIR/<topic> a 'topic folder'.
.RE
.PP
We call the folder \f[C]$MEMO_DIR/<topic>\f[] a `topic folder'.
.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
rm <topic>
remove $MEMO_DIR/topic folder with all it's content.
.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
edit <topic>
opens your favorite editor to edit the \fBmemo\fP topic
.TP
.B
list
prints a list of all topics.
.TP
.B
git <command>
run git command in $MEMO_DIR.
Once $MEMO_DIR is a git repository all \fBmemo\fP commands create commits.
.B \f[C]add\ <topic>\ [text]\f[]
Adds text to the \f[C]memo.md\f[] in the topic folder.
If text is not given it will read from stdin.
.RS
.RE
.TP
.B \f[C]rm\ <topic>\f[]
Remove \f[C]$MEMO_DIR/topic\f[] folder with all its content.
.RS
.RE
.TP
.B \f[C]copy\ <topic>\ <file\-to\-copy>\f[]
Copy a file to the topic folder.
.RS
.RE
.TP
.B \f[C]search\ <term\-to\-search>\f[]
Search for a term in \f[C]$MEMO_DIR\f[] using \f[C]ack\f[].
.RS
.RE
.TP
.B \f[C]show\ <topic>\f[]
Shows \f[C]memo.md\f[] in the topic folder.
Also shows a list of all files in the topic folder.
.RS
.RE
.TP
.B \f[C]edit\ <topic>\f[]
Opens your favorite editor to edit the memo topic.
.RS
.RE
.TP
.B \f[C]list\f[]
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
.PP
.SH CONFIGURATION
.TP
.B
$MEMO_DIR
holds the folder where to store the \fBmemo\fP files.
Default is $HOME/\fBmemo\fP
.B \f[C]$MEMO_DIR\f[]
holds the folder where to store the memo files.
Default is \f[C]$HOME/memo\f[].
.RS
.RE
.TP
.B
$EDITOR
Your favorite editor. Must be set for the edit command
.B \f[C]$EDITOR\f[]
Your favorite editor.
Must be set for the edit command.
.RS
.RE
.SH EXAMPLE
Append the string "A search-engine" to the memo.md file
in the topic "google".
.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
.fam C
$> memo add google A search-engine
.fam T
\f[C]
$\ memo\ add\ google\ A\ search\-engine
\f[]
.fi
Appends the content of "www.google.com" to the memo.md file
the topic "google".
.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
.fam C
$> curl www.google.com | memo add google
.fam T
\f[C]
$\ curl\ www.google.com\ |\ memo\ add\ google
\f[]
.fi
Copy the "Invoice.pdf" file to the "lawsuit" topic.
.PP
Copy the \[lq]Invoice.pdf\[rq] file to the \[lq]lawsuit\[rq] topic.
.IP
.nf
.fam C
$> memo copy lawsuit ~/Downloads/Invoice.pdf
.fam T
\f[C]
$\ memo\ copy\ lawsuit\ ~/Downloads/Invoice.pdf
\f[]
.fi
Make $MEMO_DIR a git repository.
.PP
Make \f[C]$MEMO_DIR\f[] a git repository.
.IP
.nf
.fam C
$> memo git init
\f[C]
$\ 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}"
function precondition::provide_memo_folder(){
function precondition:provide_memo_folder(){
if [[ ! -d ${MEMO_FOLDER} ]]
then
echo "create memo folder : ${MEMO_FOLDER}"
@ -26,7 +26,7 @@ function precondition::provide_memo_folder(){
fi
}
function precondition::provide_topic(){
function precondition:provide_topic(){
topic_name=$1
topic_path=${MEMO_FOLDER}/${topic_name}
topic_file=${topic_path}/memo.md
@ -88,7 +88,7 @@ function git:run_command(){
function remove_topic (){
topic_name=$1
#precondition::provide_topic ${topic_name}
#precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name}
if [[ -d ${topic_path} ]]
@ -106,7 +106,7 @@ function remove_topic (){
function edit_topic () {
topic_name=$1
precondition::provide_topic ${topic_name}
precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name}
if [[ -z ${EDITOR} ]]
@ -127,7 +127,7 @@ function edit_topic () {
function add_memo(){
topic_name=$1
precondition::provide_topic ${topic_name}
precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name}
topic_file=${topic_path}/memo.md
@ -178,7 +178,7 @@ function copy_file(){
exit 1
fi
precondition::provide_topic ${topic_name}
precondition:provide_topic ${topic_name}
topic_path=${MEMO_FOLDER}/${topic_name}
echo "copy '${path}' to '${topic_name}'"
@ -328,7 +328,7 @@ EOF
command=$1
shift
precondition::provide_memo_folder
precondition:provide_memo_folder
git:status
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}
'')
];
}