aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-28 13:23:56 +0200
committergramanas <anastasis.gramm2@gmail.com>2018-10-28 13:23:56 +0200
commit56fdf6de6ee00f1eb4303065c26811310a7c0728 (patch)
treeccc738f82bd91b979beb5c0b8b836f7956009d08
parent8ad6cfa33d6a37605599be5673c4acecc7eca5af (diff)
downloadck-56fdf6de6ee00f1eb4303065c26811310a7c0728.tar.gz
ck-56fdf6de6ee00f1eb4303065c26811310a7c0728.tar.bz2
ck-56fdf6de6ee00f1eb4303065c26811310a7c0728.zip
Add manpage to readme
-rw-r--r--README.html772
-rw-r--r--README.org4
-rw-r--r--src/ckutil.c14
-rw-r--r--src/ckutil.h2
4 files changed, 694 insertions, 98 deletions
diff --git a/README.html b/README.html
index d22b910..f6bd550 100644
--- a/README.html
+++ b/README.html
@@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
-<!-- 2018-10-27 Sat 12:38 -->
+<!-- 2018-10-28 Sun 13:22 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>&lrm;</title>
@@ -232,52 +232,53 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
-<li><a href="#orgbe0f74b">ck</a>
+<li><a href="#orgf8d00be">ck</a>
<ul>
-<li><a href="#orgf6d327c">Technicalities</a></li>
-<li><a href="#org2964151">Download</a></li>
+<li><a href="#orgf43f116">Technicalities</a></li>
+<li><a href="#orge578423">Download</a></li>
</ul>
</li>
<li><a href="#build-instructions">build it</a>
<ul>
-<li><a href="#orgcd68bd4">requirements</a></li>
-<li><a href="#orgd88abc4">make &amp;&amp; install</a></li>
+<li><a href="#org6787614">requirements</a></li>
+<li><a href="#org5689497">make &amp;&amp; install</a></li>
</ul>
</li>
-<li><a href="#org915da5a">for devs</a>
+<li><a href="#org8db7ac9">for devs</a>
<ul>
-<li><a href="#org00bd7c0">CMake options</a></li>
-<li><a href="#orgc80ed25">compiler</a></li>
-<li><a href="#orgb421f08">tests</a>
+<li><a href="#org42a6614">CMake options</a></li>
+<li><a href="#org5501d31">compiler</a></li>
+<li><a href="#org3720cae">tests</a>
<ul>
-<li><a href="#org099faaf">run tests</a></li>
-<li><a href="#org0c9b8e4">test suite</a></li>
+<li><a href="#org7b06e14">run tests</a></li>
+<li><a href="#org7ad16bc">test suite</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#manual">manual</a>
<ul>
-<li><a href="#org80abd4c">ck configuration</a></li>
-<li><a href="#org367dc64">Actions</a>
+<li><a href="#orgb40149d">ck configuration</a></li>
+<li><a href="#org52aba1d">Actions</a>
<ul>
-<li><a href="#org2ddbc86">init</a></li>
-<li><a href="#orgb007d62">add</a></li>
-<li><a href="#orgf17f83b">list</a></li>
-<li><a href="#orgc6b731f">search</a></li>
-<li><a href="#org7f65c8f">edit</a></li>
-<li><a href="#org8e0dc74">restore</a></li>
+<li><a href="#org7ba72be">init</a></li>
+<li><a href="#org9ae26ce">add</a></li>
+<li><a href="#orgb4adc9b">list</a></li>
+<li><a href="#org442a05c">search</a></li>
+<li><a href="#org6320932">edit</a></li>
+<li><a href="#orgae8e7fb">restore</a></li>
</ul>
</li>
</ul>
</li>
+<li><a href="#orgf44bdc3">manpage</a></li>
</ul>
</div>
</div>
<p align="center"><img src="res/logo.png"></p>
-<div id="outline-container-orgbe0f74b" class="outline-2">
-<h2 id="orgbe0f74b">ck</h2>
-<div class="outline-text-2" id="text-orgbe0f74b">
+<div id="outline-container-orgf8d00be" class="outline-2">
+<h2 id="orgf8d00be">ck</h2>
+<div class="outline-text-2" id="text-orgf8d00be">
<p>
<b>The Config Keeper</b>
</p>
@@ -333,9 +334,9 @@ with the rest of us).
</p>
</div>
-<div id="outline-container-orgf6d327c" class="outline-3">
-<h3 id="orgf6d327c">Technicalities</h3>
-<div class="outline-text-3" id="text-orgf6d327c">
+<div id="outline-container-orgf43f116" class="outline-3">
+<h3 id="orgf43f116">Technicalities</h3>
+<div class="outline-text-3" id="text-orgf43f116">
<p>
Upon adding a config to <b>ck</b>, it moves it to the specified folder and adds a symbolic link
back where it came from (<code>ln -s</code>).
@@ -348,9 +349,9 @@ majority should).
</div>
</div>
-<div id="outline-container-org2964151" class="outline-3">
-<h3 id="org2964151">Download</h3>
-<div class="outline-text-3" id="text-org2964151">
+<div id="outline-container-orge578423" class="outline-3">
+<h3 id="orge578423">Download</h3>
+<div class="outline-text-3" id="text-orge578423">
<p>
Go ahead and download <b>ck</b> and give it a try. It comes with a help sub-command
that explains any inquires you might have.
@@ -368,13 +369,13 @@ You can also read the manual <a href="#manual">down below</a>.
</div>
</div>
-<div id="outline-container-org905a4f4" class="outline-2">
-<h2 id="build-instructions"><a id="org905a4f4"></a>build it</h2>
+<div id="outline-container-orgeb48bed" class="outline-2">
+<h2 id="build-instructions"><a id="orgeb48bed"></a>build it</h2>
<div class="outline-text-2" id="text-build-instructions">
</div>
-<div id="outline-container-orgcd68bd4" class="outline-3">
-<h3 id="orgcd68bd4">requirements</h3>
-<div class="outline-text-3" id="text-orgcd68bd4">
+<div id="outline-container-org6787614" class="outline-3">
+<h3 id="org6787614">requirements</h3>
+<div class="outline-text-3" id="text-org6787614">
<ul class="org-ul">
<li>cmake</li>
<li>sqlite3-dev</li>
@@ -383,9 +384,9 @@ You can also read the manual <a href="#manual">down below</a>.
</div>
</div>
-<div id="outline-container-orgd88abc4" class="outline-3">
-<h3 id="orgd88abc4">make &amp;&amp; install</h3>
-<div class="outline-text-3" id="text-orgd88abc4">
+<div id="outline-container-org5689497" class="outline-3">
+<h3 id="org5689497">make &amp;&amp; install</h3>
+<div class="outline-text-3" id="text-org5689497">
<p>
Use <code>-DCMAKE_INSTALL_PREFIX</code> when running cmake to change the install path.
</p>
@@ -408,16 +409,16 @@ Use <code>-DCMAKE_INSTALL_PREFIX</code> when running cmake to change the install
</div>
</div>
-<div id="outline-container-org915da5a" class="outline-2">
-<h2 id="org915da5a">for devs</h2>
-<div class="outline-text-2" id="text-org915da5a">
+<div id="outline-container-org8db7ac9" class="outline-2">
+<h2 id="org8db7ac9">for devs</h2>
+<div class="outline-text-2" id="text-org8db7ac9">
<p>
Please be <a href="https://www.gnu.org/philosophy/kind-communication.html">kind</a> to each other.
</p>
</div>
-<div id="outline-container-org00bd7c0" class="outline-3">
-<h3 id="org00bd7c0">CMake options</h3>
-<div class="outline-text-3" id="text-org00bd7c0">
+<div id="outline-container-org42a6614" class="outline-3">
+<h3 id="org42a6614">CMake options</h3>
+<div class="outline-text-3" id="text-org42a6614">
<p>
cmake accepts the following options:
</p>
@@ -438,9 +439,9 @@ To use any one of them append it after the cmake command like so:
</div>
</div>
-<div id="outline-container-orgc80ed25" class="outline-3">
-<h3 id="orgc80ed25">compiler</h3>
-<div class="outline-text-3" id="text-orgc80ed25">
+<div id="outline-container-org5501d31" class="outline-3">
+<h3 id="org5501d31">compiler</h3>
+<div class="outline-text-3" id="text-org5501d31">
<p>
Pick your favorite
</p>
@@ -470,9 +471,9 @@ Pick your favorite
</div>
</div>
-<div id="outline-container-orgb421f08" class="outline-3">
-<h3 id="orgb421f08">tests</h3>
-<div class="outline-text-3" id="text-orgb421f08">
+<div id="outline-container-org3720cae" class="outline-3">
+<h3 id="org3720cae">tests</h3>
+<div class="outline-text-3" id="text-org3720cae">
<p>
The testing "suite" is a bash script that runs regression
and unit tests. Regression tests are under the <code>tests/</code> directory
@@ -481,9 +482,9 @@ under <code>unit/</code> directory and test the code.
</p>
</div>
-<div id="outline-container-org099faaf" class="outline-4">
-<h4 id="org099faaf">run tests</h4>
-<div class="outline-text-4" id="text-org099faaf">
+<div id="outline-container-org7b06e14" class="outline-4">
+<h4 id="org7b06e14">run tests</h4>
+<div class="outline-text-4" id="text-org7b06e14">
<p>
First make sure you build ck with the <code>-DCK_TESTS=1</code> option. Then
go to the build directory and type:
@@ -495,9 +496,9 @@ go to the build directory and type:
</div>
</div>
-<div id="outline-container-org0c9b8e4" class="outline-4">
-<h4 id="org0c9b8e4">test suite</h4>
-<div class="outline-text-4" id="text-org0c9b8e4">
+<div id="outline-container-org7ad16bc" class="outline-4">
+<h4 id="org7ad16bc">test suite</h4>
+<div class="outline-text-4" id="text-org7ad16bc">
<div class="org-src-container">
<pre class="src src-sh">$ ./test-ck -h
ck test suite
@@ -515,8 +516,8 @@ flags:
</div>
</div>
</div>
-<div id="outline-container-org4e88e4b" class="outline-2">
-<h2 id="manual"><a id="org4e88e4b"></a>manual</h2>
+<div id="outline-container-orgfd8f2dc" class="outline-2">
+<h2 id="manual"><a id="orgfd8f2dc"></a>manual</h2>
<div class="outline-text-2" id="text-manual">
<p>
ck's goal is to assist with the configuration file management.
@@ -568,9 +569,9 @@ of flags one has to pass to ck.
</p>
</div>
-<div id="outline-container-org80abd4c" class="outline-3">
-<h3 id="org80abd4c">ck configuration</h3>
-<div class="outline-text-3" id="text-org80abd4c">
+<div id="outline-container-orgb40149d" class="outline-3">
+<h3 id="orgb40149d">ck configuration</h3>
+<div class="outline-text-3" id="text-orgb40149d">
<p>
ck uses sqlite to index the configuration files. The init
action creates a <b>.ck</b> directory (under <code>$HOME</code>)
@@ -608,13 +609,13 @@ $ ck -c /someplace/else ...
</div>
</div>
-<div id="outline-container-org367dc64" class="outline-3">
-<h3 id="org367dc64">Actions</h3>
-<div class="outline-text-3" id="text-org367dc64">
+<div id="outline-container-org52aba1d" class="outline-3">
+<h3 id="org52aba1d">Actions</h3>
+<div class="outline-text-3" id="text-org52aba1d">
</div>
-<div id="outline-container-org2ddbc86" class="outline-4">
-<h4 id="org2ddbc86">init</h4>
-<div class="outline-text-4" id="text-org2ddbc86">
+<div id="outline-container-org7ba72be" class="outline-4">
+<h4 id="org7ba72be">init</h4>
+<div class="outline-text-4" id="text-org7ba72be">
<p>
or i or -i
</p>
@@ -644,9 +645,9 @@ $ ck init /path_to/where_you_want/your_configs/to_be <span style="color: #bdbc61
</div>
</div>
-<div id="outline-container-orgb007d62" class="outline-4">
-<h4 id="orgb007d62">add</h4>
-<div class="outline-text-4" id="text-orgb007d62">
+<div id="outline-container-org9ae26ce" class="outline-4">
+<h4 id="org9ae26ce">add</h4>
+<div class="outline-text-4" id="text-org9ae26ce">
<p>
or a or -a
</p>
@@ -687,9 +688,9 @@ $ ck add program_name config_path [-s] [-p]
</div>
</div>
-<div id="outline-container-orgf17f83b" class="outline-4">
-<h4 id="orgf17f83b">list</h4>
-<div class="outline-text-4" id="text-orgf17f83b">
+<div id="outline-container-orgb4adc9b" class="outline-4">
+<h4 id="orgb4adc9b">list</h4>
+<div class="outline-text-4" id="text-orgb4adc9b">
<p>
or ls or l or -l
</p>
@@ -752,9 +753,9 @@ $ ck -l ckconf
</div>
</div>
-<div id="outline-container-orgc6b731f" class="outline-4">
-<h4 id="orgc6b731f">search</h4>
-<div class="outline-text-4" id="text-orgc6b731f">
+<div id="outline-container-org442a05c" class="outline-4">
+<h4 id="org442a05c">search</h4>
+<div class="outline-text-4" id="text-org442a05c">
<p>
or grep or s or -s
</p>
@@ -803,9 +804,9 @@ $ for i ($(ck ls paths)) grep -E <span style="color: #bdbc61;">'A|B'</span> $<sp
</div>
</div>
-<div id="outline-container-org7f65c8f" class="outline-4">
-<h4 id="org7f65c8f">edit</h4>
-<div class="outline-text-4" id="text-org7f65c8f">
+<div id="outline-container-org6320932" class="outline-4">
+<h4 id="org6320932">edit</h4>
+<div class="outline-text-4" id="text-org6320932">
<p>
or e or -e
</p>
@@ -851,9 +852,9 @@ $ ck edit emacs accounts.el
</div>
</div>
-<div id="outline-container-org8e0dc74" class="outline-4">
-<h4 id="org8e0dc74">restore</h4>
-<div class="outline-text-4" id="text-org8e0dc74">
+<div id="outline-container-orgae8e7fb" class="outline-4">
+<h4 id="orgae8e7fb">restore</h4>
+<div class="outline-text-4" id="text-orgae8e7fb">
<p>
or r or -r
</p>
@@ -904,9 +905,616 @@ take care of the already created links, if that's the case.
</div>
</div>
</div>
+<div id="outline-container-orgf44bdc3" class="outline-2">
+<h2 id="orgf44bdc3">manpage</h2>
+<div class="outline-text-2" id="text-orgf44bdc3">
+<!-- Creator : groff version 1.22.3 -->
+<!-- CreationDate: Sun Oct 28 13:22:50 2018 -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta name="generator" content="groff -Thtml, see www.gnu.org">
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<meta name="Content-Style" content="text/css">
+<style type="text/css">
+ p { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ table { margin-top: 0; margin-bottom: 0; vertical-align: top }
+ h1 { text-align: center }
+</style>
+<title>ck</title>
+
+</head>
+<body>
+
+<h1 align="center">ck</h1>
+
+<a href="#NAME">NAME</a><br>
+<a href="#SYNOPSIS">SYNOPSIS</a><br>
+<a href="#DESCRIPTION">DESCRIPTION</a><br>
+<a href="#OPTIONS">OPTIONS</a><br>
+<a href="#ACTIONS">ACTIONS</a><br>
+<a href="#EXIT STATUS">EXIT STATUS</a><br>
+<a href="#FILES">FILES</a><br>
+<a href="#BUILD VALUES">BUILD VALUES</a><br>
+<a href="#VERSION">VERSION</a><br>
+<a href="#AUTHOR">AUTHOR</a><br>
+
+<hr>
+
+
+<h2>NAME
+<a name="NAME"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">ck &minus;
+manage configuration across the system</p>
+
+<h2>SYNOPSIS
+<a name="SYNOPSIS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ck</b>
+[<b>&minus;v</b>|<b>&minus;&minus;verbose</b>]
+[<b>&minus;c</b>|<b>&minus;&minus;config</b> <i>DIR</i>]
+<i>action&nbsp;</i>[...] <b><br>
+ck</b> [<b>version</b>|<b>&minus;&minus;version</b>] <b><br>
+ck init</b> <i>VERSION_CONTROL_DIR SECRET_DIR</i> <b><br>
+ck add</b> <i>PROGRAM_NAME CONFIG_PATH</i> [<b>&minus;p</b>]
+[<b>&minus;s</b>] <b><br>
+ck delete</b>
+<i>PROGRAM_NAME</i>|{<b>&minus;c&nbsp;</b><i>CONFIG_PATH</i>}
+<b><br>
+ck list tree&nbsp;</b>[<b>&minus;a</b>] <b><br>
+ck list</b>
+{<b>-p&nbsp;</b><i>PROGRAM_NAME</i>}|<b>programs</b>|<b>paths&nbsp;</b>[<b>&minus;t</b>
+{<b>plain</b>|<b>python</b>|<b>lisp</b>}] [<b>&minus;a</b>]
+<b><br>
+ck list ckconf <br>
+ck edit</b>
+<i>PROGRAM_NAME&nbsp;</i>[<i>CONFIG_BASENAME</i>] <b><br>
+ck search</b> <i>SEARCH_TERM</i> <b><br>
+ck restore</b> <i>PROGRAM_NAME</i>|<b>all <br>
+ck help</b> <i>action</i></p>
+
+<h2>DESCRIPTION
+<a name="DESCRIPTION"></a>
+</h2>
+
+
+
+<p style="margin-left:11%; margin-top: 1em"><i><b>ck</b></i>
+manages configuration files in a Linux system. To that end
+it provides an <b>action</b> based command line
+interface.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>ck</b> needs
+a database and an rc file to run. It also needs two
+directories (stored in the rc file), the
+<i>VERSION_CONRTOL_DIR</i> and the <i>SECRET_DIR</i>. This
+is where the configurations will end up after they are added
+to <b>ck</b>. The <b>init</b> action takes care of them. For
+more details see the
+<b>ACTIONS&nbsp;</b>and&nbsp;<b>FILES</b> sections
+below.</p>
+
+<p style="margin-left:11%; margin-top: 1em">In <b>ck</b>
+terms a <i>program</i> is an entity that has one or more
+<i>configs</i> attached to it. Each <i>program</i> can have
+exactly one <b>primary&nbsp;</b><i>config</i>. Upon adding a
+<i>config</i> to <b>ck</b>, it is moved to the appropriate
+directory, and then symbolically linked back to it&rsquo;s
+original place (<i>ln -s</i>).</p>
+
+<p style="margin-left:11%; margin-top: 1em">In a later time
+you can sync the <i>VERSION_CONRTOL_DIR</i> and
+<i>SECRET_DIR</i>. You can also <b>restore</b> the links
+given these two directories and the correspondig rc file and
+database.</p>
+
+<h2>OPTIONS
+<a name="OPTIONS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Change
+<b>ck</b> behaviour using the following options. They must
+be present before any <b>action. <br>
+&minus;&minus;verbose</b>, <b>&minus;v</b></p>
+
+<p style="margin-left:22%;">[WIP] <br>
+Currently prints the log. Must be the first argument in
+order to work.</p>
+
+<p style="margin-left:11%;"><b>&minus;&minus;config</b>
+<i>DIR</i>, <b>&minus;c</b> <i>DIR</i></p>
+
+<p style="margin-left:22%;">Use
+<b>ckdb&nbsp;</b>and&nbsp;<b>ckrc</b> residing in <i>DIR</i>
+instead of the default <i>~/.ck/</i>.</p>
+
+<p style="margin-left:11%;"><b>&minus;&minus;version</b>,
+<b>version</b></p>
+
+<p style="margin-left:22%;">Print version and licence
+information, and quit.</p>
+
+<h2>ACTIONS
+<a name="ACTIONS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">Each
+<b>action</b> has several aliases. The selected
+<b>action</b> must be after the <b>OPTIONS</b> if any. All
+available <b>actions</b> can be seen in the <b>SYNOPSIS</b>
+section above.</p>
+
+<p style="margin-left:11%; margin-top: 1em">Each
+<b>action</b> takes a number of arguments and flags.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Initialize
+ck</b> <br>
+Create the <b>ck</b> database (<i>ckdb</i>) and initialize
+it. Create the ck config file (<i>ckrc</i>) and add the
+directory paths to it.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck init</b>
+<i>VERSION_CONTROL_DIR SECRET_DIR</i></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>init</b>,&nbsp;<b>i</b>,&nbsp;<b>&minus;i</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>VERSION_CONTROL_DIR</i></p>
+
+<p style="margin-left:17%;">The directory where
+<b>configs</b> will be stored by default. <b>File must
+exist</b>.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><i>SECRET_DIR</i></p>
+
+<p style="margin-left:17%;">The directory where
+<b>configs</b> will be stored when using the <b>&minus;s</b>
+flag in <b>add</b>. <b>File must exist</b>.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck init
+/home/ckuser/configs/vc home/ckuser/configs/sec <br>
+$ ck i configs/vc configs/sec</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Add
+config</b> <br>
+Add a <b>config</b> to the database (<i>ckdb</i>). Each
+<b>config</b> belongs to a <b>program</b>. Every
+<b>program</b> can have multiple <b>configs</b> under it and
+one of them can be <b>primary</b>. The <b>edit action</b>
+will open the <b>primary config</b> by default.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck add</b> <i>PROGRAM_NAME
+CONFIG_PATH</i> [<b>&minus;p</b>] [<b>&minus;s</b>]</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>add</b>,&nbsp;<b>a</b>,&nbsp;<b>&minus;a</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>PROGRAM_NAME</i></p>
+
+<p style="margin-left:17%;">The name of the <b>program</b>
+the <b>config</b> belongs at.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><i>CONFIG_PATH</i></p>
+
+<p style="margin-left:17%;">Path to the <b>config</b>. Can
+be relative.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>FLAGS</b></p>
+
+<p style="margin-left:14%;"><b>&minus;s</b></p>
+
+<p style="margin-left:17%;">Mark the <b>config</b> as
+secret. It will be stored on the <i>SECRET_DIR</i>.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>&minus;p</b></p>
+
+<p style="margin-left:17%;">Mark the <b>config</b> as
+primary. The <b>edit action</b> will open this by
+default.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;"># add emacs configs <br>
+## primary config <br>
+$ ck add emacs ~/.emacs.d/orgconf.org -p <br>
+## secret config, with passwords <br>
+$ ck add emacs ~/.emacs.d/accounts.org -s <br>
+## another one for emacs <br>
+$ ck add emacs ~/.emacs.d/init.el</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Delete
+config</b> <br>
+Delete a <b>config</b> or a <b>program</b> from the database
+(<i>ckdb</i>). This will not touch the actual file and link.
+It is up to the user to handle it.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck delete</b>
+<i>PROGRAM_NAME</i>|{<b>&minus;c&nbsp;</b><i>CONFIG_PATH</i>}</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>delete</b>,&nbsp;<b>del</b>,&nbsp;<b>d</b>,&nbsp;<b>&minus;d</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>PROGRAM_NAME</i></p>
+
+<p style="margin-left:17%;">Delete the <b>program</b> and
+all it&rsquo;s <b>configs</b>.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>&minus;c&nbsp;</b><i>CONFIG_PATH</i></p>
+
+<p style="margin-left:17%;">Delete the <b>config</b>. This
+has to be the full path of the link as shown by the <b>list
+action</b>.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b>
+<br>
+$ ck delete emacs <br>
+$ ck del -c /home/ckuser/.emacs.d/init.el</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>List</b>
+<br>
+List programs, configs and ck configuration values.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck list
+tree&nbsp;</b>[<b>&minus;a</b>] <b><br>
+ck list</b>
+{<b>-p&nbsp;</b><i>PROGRAM_NAME</i>}|<b>programs</b>|<b>paths&nbsp;</b>[<b>&minus;t</b>
+{<b>plain</b>|<b>python</b>|<b>lisp</b>}] [<b>&minus;a</b>]
+<b><br>
+ck list ckconf</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>list</b>,&nbsp;<b>ls</b>,&nbsp;<b>l</b>,&nbsp;<b>-ls</b>,&nbsp;<b>&minus;l</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><b>tree</b></p>
+
+<p style="margin-left:17%;">List <b>programs</b> with their
+<b>configs</b> in a tree like structure.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>paths</b></p>
+
+<p style="margin-left:17%;">List all the <b>config</b>
+paths <b>ck</b> keeps track of.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>programs</b></p>
+
+<p style="margin-left:17%;">List all the <b>programs ck</b>
+keeps track of.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>&minus;c&nbsp;</b><i>PROGRAM_NAME</i></p>
+
+<p style="margin-left:17%;">List all the <b>configs</b> of
+<i>PROGRAM_NAME</i>.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>ckconf</b></p>
+
+<p style="margin-left:17%;">List the <b>ck</b>
+configuration values, like the
+<i>VERSION_CONTROL_DIR&nbsp;</i>and&nbsp;<i>SECRET_DIR</i>.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>FLAGS</b></p>
+
+<p style="margin-left:14%;"><b>&minus;t</b></p>
+
+<p style="margin-left:17%;">Set the type of the
+<b>list</b>. Can be either <b>plain</b> (the default) a
+simple list, <b>python</b> to print it like a python array
+or <b>lisp</b> to print it like a lisp list.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><b>&minus;a</b></p>
+
+<p style="margin-left:17%;">Add attributes to the listing
+(when aplicable). The attributes are <b>[s]</b> for
+<b>secret</b>, <b>[p]</b> for <b>primary</b> and
+<b>[root]</b> if the file is owned by the root user.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck list tree -a <br>
+$ ck list paths -t lisp <br>
+$ ck list programs -t python <br>
+$ ck list -p emacs</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Edit
+configs</b> <br>
+Edit a <b>config</b> stored in <b>ck</b> with the
+<i>$EDITOR</i>. <b>Edit</b> will open the <b>primary
+config</b> of the <b>program</b>. If there is no <b>primary
+config</b> but the <b>program</b> only has one
+<b>config</b>, <b>edit</b> will open that. Whenever there is
+ambiguity, a list of possible <b>configs</b> will be
+shown.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck edit</b>
+<i>PROGRAM_NAME&nbsp;</i>[<i>CONFIG_BASENAME</i>]</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>edit</b>,&nbsp;<b>e</b>,&nbsp;<b>&minus;e</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>PROGRAM_NAME</i></p>
+
+<p style="margin-left:17%;">The name of the <b>program</b>
+to be edited. If the <b>program</b> has only one
+<b>config</b> or you want to edit the <b>primary</b> one, no
+further action is required.</p>
+
+
+<p style="margin-left:14%; margin-top: 1em"><i>CONFIG_BASENAME</i></p>
+
+<p style="margin-left:17%;">The basename of the
+<b>config</b> to be edited. This has to follow the
+<b>program</b> name. It is only needed when editing a
+<b>config</b> other than the <b>primary</b> one.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck edit emacs <br>
+$ ck e tmux .tmux.conf</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Search
+configs</b> <br>
+Grep through the configs. This <b>action</b> is equivalent
+to this:</p>
+
+<p style="margin-left:11%; margin-top: 1em">$ ck ls paths |
+xargs grep -H -n &quot;search term&quot;</p>
+
+<p style="margin-left:11%; margin-top: 1em">Thus for more
+advanced search through the <b>configs</b> one can use other
+programs and replace grep in the command above.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck search</b>
+<i>SEARCH_TERM</i></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>search</b>,&nbsp;<b>grep</b>,&nbsp;<b>s</b>,&nbsp;<b>&minus;s</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>SEARCH_TERM</i></p>
+
+<p style="margin-left:17%;">The term you wish to search
+for. If it&rsquo;s a phrase enclose it in &quot;&quot;. If
+it&rsquo;s a special character you can escape it with \
+(backslash).</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck search &quot;search
+term&quot; $ ck search &quot;quire&quot;</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Restore
+configs</b> <br>
+Given a working <b>ck</b> instance (<i>ckdb</i> +
+<i>ckrc</i> + directories in <i>ckrc</i> with
+<b>configs</b>),&nbsp;<b>restore</b> shall recreate the
+links from the <b>config</b> directories in <i>ckrc</i> back
+to their corresponding position when added to <b>ck</b>. It
+is useful for copying <b>configs</b> to a new linux
+installation or <b>restoring</b> deleted links. It can
+either <b>restore</b> a specific <b>program</b> or all of
+them.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck restore</b>
+<i>PROGRAM_NAME</i>|<b>all</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>restore</b>,&nbsp;<b>r</b>,&nbsp;<b>&minus;r</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>PROGRAM_NAME</i></p>
+
+<p style="margin-left:17%;">The name of the <b>program</b>
+to be restored.</p>
+
+<p style="margin-left:14%; margin-top: 1em"><b>all</b></p>
+
+<p style="margin-left:17%;">Restore all <b>programs ck</b>
+keeps track of.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck restore all <br>
+$ ck restore -p emacs</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>Get help</b>
+<br>
+Get help for any given <b>action</b> from the command
+line.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>USAGE</b></p>
+
+<p style="margin-left:14%;"><b>ck help</b>
+<i>action</i></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ALIASES</b></p>
+
+
+<p style="margin-left:14%;"><b>help</b>,&nbsp;<b>h</b>,&nbsp;<b>&minus;&minus;help</b>,&nbsp;<b>-h</b>,&nbsp;<b>&minus;?</b></p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ARGUMENTS</b></p>
+
+<p style="margin-left:14%;"><i>action</i></p>
+
+<p style="margin-left:17%;">Any <b>action alias</b> you
+wish to get help for.</p>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>EXAMPLES</b></p>
+
+<p style="margin-left:14%;">$ ck help add <br>
+$ ck h d <br>
+$ ck --help ls</p>
+
+<h2>EXIT STATUS
+<a name="EXIT STATUS"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>ck</b> shall
+return 0 if the action was completed without an error, -1
+otherwise</p>
+
+<h2>FILES
+<a name="FILES"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">By default
+<b>ck</b> will store it&rsquo;s files in <i>~/.ck/</i>.
+Using the <b>&minus;c</b>|<b>&minus;&minus;config</b> one
+can change this.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>ck generated
+files</b> <i><br>
+~/.ck/ckrc</i></p>
+
+<p style="margin-left:22%;">Store the configuration values
+(<i>VERSION_CONTROL_DIR</i> and <i>SECRET_DIR</i>).</p>
+
+<p style="margin-left:11%;"><i>~/.ck/ckdb</i></p>
+
+<p style="margin-left:22%;">SQLite3 database.</p>
+
+<p style="margin-left:11%; margin-top: 1em"><b>User
+files</b> <i><br>
+VERSION_CONTROL_DIR</i></p>
+
+<p style="margin-left:22%;">This is where the configuration
+files will end up by default. It&rsquo;s value is set with
+the <b>init</b> action, but can be changed by editing
+<i>ckrc</i>.</p>
+
+<p style="margin-left:11%;"><i>SECRET_DIR</i></p>
+
+<p style="margin-left:22%;">This is where the configuration
+files will end up when adding them with the <b>-s</b> flag.
+It&rsquo;s value is set with the <b>init</b> action, but can
+be changed by editing <i>ckrc</i>.</p>
+
+<h2>BUILD VALUES
+<a name="BUILD VALUES"></a>
+</h2>
+
+
+
+<p style="margin-left:11%; margin-top: 1em"><b>compiler</b>:
+@CMAKE_C_COMPILER@ <b><br>
+flags</b>: @CMAKE_C_FLAGS@</p>
+
+<h2>VERSION
+<a name="VERSION"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">ck version
+@ck_MAJOR_VERSION@.@ck_MINOR_VERSION@.@ck_PATCH_VERSION@</p>
+
+<h2>AUTHOR
+<a name="AUTHOR"></a>
+</h2>
+
+
+<p style="margin-left:11%; margin-top: 1em">gramanas</p>
+<hr>
+</body>
+</html>
+</div>
+</div>
</div>
<div id="postamble" class="status">
-<p class="date">Created: 2018-10-27 Sat 12:38</p>
+<p class="date">Created: 2018-10-28 Sun 13:22</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
diff --git a/README.org b/README.org
index 3e1c20f..379e61c 100644
--- a/README.org
+++ b/README.org
@@ -387,3 +387,7 @@ ck checks that the configs exist and that the location for the link
is avaliable before making any links. However, in the even that symlink
fails for some other reason, the process will stop as is. Make sure you
take care of the already created links, if that's the case.
+* manpage
+#+BEGIN_SRC sh :results output html :exports results
+ groff ck.1 -mandoc -Thtml
+#+END_SRC
diff --git a/src/ckutil.c b/src/ckutil.c
index 06d12da..79d7fd3 100644
--- a/src/ckutil.c
+++ b/src/ckutil.c
@@ -34,20 +34,6 @@ int util_is_dir(const char *path) {
return 1;
}
-void util_replace_slash_with_uscore(char *s) {
- if (!s) {
- return;
- }
- int i = 0;
- while (*s != '\0') {
- if (*s == '/' && i != 0) {
- *s = '_';
- }
- s++;
- i++;
- }
-}
-
int util_file_exists(const char* path, char *absPath) {
if (!path || !absPath) {
return 0;
diff --git a/src/ckutil.h b/src/ckutil.h
index 9f3cb39..8ca9ca1 100644
--- a/src/ckutil.h
+++ b/src/ckutil.h
@@ -78,8 +78,6 @@ extern int util_is_file_rw(const char *path);
/* Returns 1 if file is link 0 otherwise */
extern int util_is_file_link(const char *path);
-extern void util_replace_slash_with_uscore(char *s);
-
/* Wrapper around mkdir with 0775 permissions */
extern void util_mkdir(const char *path);