From be408978f54f83d393494d9ca263b88d4c596725 Mon Sep 17 00:00:00 2001 From: Anastasis Grammenos Date: Sun, 23 Sep 2018 00:03:05 +0300 Subject: update readme & add manual --- README.html | 379 +++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 335 insertions(+), 44 deletions(-) (limited to 'README.html') diff --git a/README.html b/README.html index 227c7f6..72df0fc 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -232,21 +232,35 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 ck

+
+

1 ck

The Config Keeper @@ -264,12 +278,12 @@ for the JavaScript code in this tag.

-
-

2 build it

+
+

2 build it

-
-

2.1 requirements

+
+

2.1 requirements

  • clang (llvm) or gcc (gnu)
  • @@ -279,8 +293,8 @@ for the JavaScript code in this tag.
-
-

2.2 compiler

+
+

2.2 compiler

By default I use clang, if you want to use gcc just @@ -289,19 +303,19 @@ edit the CMakeLists.txt file and change clang to

-
-

2.3 make

+
+

2.3 make

-
# clone the repo
+
# clone the repo
 > cd ~/code; git clone https://gitlab.com/grm-grm/ck
-# make a build directory and enter it
-> mkdir ~/ck_build; cd ~/ck_build;
-# run cmake
+# make a build directory and enter it
+> mkdir ~/ck_build; cd ~/ck_build;
+# run cmake
 > cmake ~/code/ck
-# run make
+# run make
 > make
-# run ck
+# run ck
 > ./ck
 
@@ -309,35 +323,35 @@ edit the CMakeLists.txt file and change clang to
-
-

3 for devs

+
+

3 for devs

-
-

3.1 make

+
+

3.1 make

Just build with address sanitizer enabled like so: llvm has better asan than gcc, so I use that.

-
# clone the repo
+
# clone the repo
 > cd ~/code; git clone https://gitlab.com/grm-grm/ck
-# make a build directory and enter it
-> mkdir ~/ck_build; cd ~/ck_build;
-# run cmake
+# make a build directory and enter it
+> mkdir ~/ck_build; cd ~/ck_build;
+# run cmake
 > cmake ~/code/ck -DCK_ASAN=ON
-# run make
+# run make
 > make
-# run ck
+# run ck
 > ./ck
 
-
-

3.2 tests

+
+

3.2 tests

The testing "suite" is a bash script that runs regression @@ -347,8 +361,8 @@ under unit/ directory and test the code.

-
-

3.2.1 run tests

+
+

3.2.1 run tests

Simply go to the build dir and type. @@ -360,8 +374,8 @@ Simply go to the build dir and type.

-
-

3.2.2 test suite

+
+

3.2.2 test suite

$ ./check_ck -h
@@ -380,9 +394,286 @@ flags:
 
+
+

4 manual

+
+

+ck's goal is to assist with the configuration file management. +To that end it tries to provides a cli interface that is pretty straight-forward +and intuitive. +

+ +

+Example usage: +

+
+
# initialize new ck
+$ ck init /path_to/where_you_want/your_configs/to_be \
+  /path_to/the_secret/directory
+
+# add emacs configs
+## primary config
+$ ck add emacs ~/.emacs.d/orgconf.org -p
+## secret config, with passwords and naughty words
+$ ck add emacs ~/.emacs.d/accounts.org -s
+## and another one for emacs
+$ ck add emacs ~/.emacs.d/init.el
+
+# add tmux config
+$ ck add tmux ~/.tmux.conf -p
+
+# list the configs
+$ ck list tree
+$ ck list paths -t lisp
+$ ck list programs -t python
+
+# search the configs
+$ ck search search-term
+$ ck search "\"search term with spaces\""
+$ ck search "\(" #escape symbols
+
+
+ +

+The first command after typing ck is the action you wish to perform. Actions are +a very important concept of ck. With an action you can initialize ck, add/move/delete +configuration files to it, edit them, list them in various ways and search in their content. +

+ +

+Actions expect their arguments in the order specified below. This is done to reduce the amount +of flags one has to pass to ck. +

+
+ +
+

4.1 ck configuration

+
+

+ck uses sqlite to index the configuration files. The init +action creates a .ck directory (under $HOME) +in witch the ckrc and the ckdb reside. The first one contains +the two directories described above while the other one is the +sqlite db. +

+ +

+One can have multiple config directories with different configurations +each. +

+ +

+Using the special keyword config (or conf or c or -c) you can set the path +in which ck will search for the .ck directory. +

+ +

+You can prefix every action with this and ck will use the configuration +directory of your choice. +

+ +

+Usage: +

+
+
$ ck config ~/ ... # the default behaviour
+
+# /someplace/else must exist or
+# the action following it must be init
+$ ck conf /someplace/else ... 
+
+# same thing
+$ ck c /someplace/else ... 
+$ ck -c /someplace/else ... 
+
+
+
+
+ +
+

4.2 Actions

+
+
+
+

4.2.1 init

+
+

+or i or -i +

+ +

+init takes exactly 2 arguments. +

+ +
    +
  • configdir: where all the configs will live
  • +
  • secretdir: where all the secret configs will live
  • +
+ +

+Use init to initialize a new ck database. +

+ +

+Usage: +

+
+
# initialize new ck
+$ ck init /path_to/where_you_want/your_configs/to_be \
+  /path_to/the_secret/directory
+
+
+
+
+ +
+

4.2.2 add

+
+

+or a or -a +

+ +

+Add takes 2 to 4 arguments. +

+ +
    +
  • programname: the name of the program you add a config to
  • +
  • configpath: the path to the config
  • +
  • Optional: (order doesn't matter) +
      +
    • -p: the config will be the primary (relevant on edit below)
    • +
    • -s: the config will be stored in the secretdir
    • +
  • +
+ +

+Use add to add a new config for ck to keep track of. +

+ +

+Keep in mind: +

+
    +
  • The config has to exist
  • +
  • If you are adding a config to a program already existing in ckdb make +sure to use the same name
  • +
  • Each program can have only one primary config
  • +
+ +

+Usage: +

+
+
# add config to ck
+$ ck add program_name config_path [-s] [-p]
+
+
+
+
+ +
+

4.2.3 list

+
+

+or ls or l or -l +

+ +

+List can show the paths or the programs that ck keeps track of. +With the flag -t and then one of the follwing types one can change +the way the list is printed: +

+
    +
  • plain: simple listing (default)
  • +
  • python: print like a python list
  • +
  • lisp: print like a lisp list
  • +
+ +

+Using the keyword tree ck can list the configurations under their +corresponding program. +

+ +
+
/* TODO: show primary and secret atributes */
+
+
+

+Usage: +

+
+
# list tree structure
+$ ck list tree
+# list paths in python
+$ ck l paths -t python
+# list programs in lisp
+$ ck ls programs -t lisp
+
+
+
+
+ +
+

4.2.4 search

+
+

+or s or -s +

+ +

+Perform infile grep in all the configurations ck keeps track of. +

+ +

+Takes one argument, the search-term. +

+ +

+To search for terms with spaces you have to put them in escaped quotes. +To search for special symbols you have to enclose them in quotes and escape them. +

+ +

+Usage: +

+
+
# search for parenthesis
+$ ck search "\("
+# search term with spaces
+$ ck search "\"This is a space\""
+# both
+$ ck search "\"(add 2 4)\""
+# and a normal one
+$ ck search alias
+
+
+
+
+ +
+

4.2.5 edit

+
+

+or e or -e +~--WIP--~ +Currently edit can only edit the primary config of a program. +

+ +

+To do it use: +

+
+
$ ck edit program_name
+
+
+
+
+
+
-

Created: 2018-09-20 Thu 20:23

+

Created: 2018-09-23 Sun 00:02

Validate

-- cgit v1.2.3