Generate man page with pandoc

master
Kierán Meinhardt 2018-12-28 18:09:59 +01:00
parent 64518e980a
commit 9685d713f2
5 changed files with 85 additions and 179 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.swp
doc/memo.1

View File

@ -1,112 +0,0 @@
.\" Text automatically generated by txt2man
.TH memo 1 "10 August 2018" "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
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.
.RE
.PP
.SH CONFIGURATION
.TP
.B
$MEMO_DIR
holds the folder where to store the \fBmemo\fP files.
Default is $HOME/\fBmemo\fP
.TP
.B
$EDITOR
Your favorite editor. Must be set for the edit command
.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
.fam T
.fi
Make $MEMO_DIR a git repository.
.PP
.nf
.fam C
$> memo git init

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

@ -0,0 +1,71 @@
% memo
%
% 10 August 2018
# 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

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}
'')
];
}