aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-27 18:11:22 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-10-27 18:11:22 +0300
commit44b28c07a4a3cdbe4f84e57cfa55082956e300ba (patch)
treee4f2d2478f034781bc9274fa1712e7bd33047ddf
parent2922690b716540b7e3971ffbdf506148503c7788 (diff)
downloadck-44b28c07a4a3cdbe4f84e57cfa55082956e300ba.tar.gz
ck-44b28c07a4a3cdbe4f84e57cfa55082956e300ba.tar.bz2
ck-44b28c07a4a3cdbe4f84e57cfa55082956e300ba.zip
Add manpage
-rw-r--r--CMakeLists.txt7
-rw-r--r--ck.1145
-rw-r--r--src/actionparser.c4
3 files changed, 154 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ed42c6..bb03dfb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,12 @@ configure_file(
"${SRC_DIR}/ckinfo.h"
)
+# configure the manpage
+configure_file(
+ "ck.1"
+ "${CMAKE_BINARY_DIR}/ck.1"
+ )
+
# Set source code locations
set(ckBin_src ${SRC_DIR}/ck.c)
set(ckUnitTest_src ${UNIT_TEST_DIR}/ck-test.c)
@@ -102,6 +108,7 @@ target_link_libraries(ck ckLib)
target_link_libraries(ck ${SQLITE3_LIBRARIES})
install(TARGETS ck DESTINATION bin)
+install(FILES ${CMAKE_BINARY_DIR}/ck.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)
if (CK_TESTS)
## unit test
diff --git a/ck.1 b/ck.1
new file mode 100644
index 0000000..b42aef4
--- /dev/null
+++ b/ck.1
@@ -0,0 +1,145 @@
+.TH ck 1 "2018-10-27" Linux "ck - the config keeper"
+.SH NAME
+ck \- manage configuration across the system
+.SH SYNOPSIS
+.B ck
+.RB [ \-v | \-\-verbose ]
+.RB [ \-c | \-\-config
+.IR DIR ]
+.IR action \ [.\|.\|.]
+.br
+.B ck
+.RB [ version | \-\-version ]
+.br
+.B ck init
+.I VERSION_CONTROL_DIR SECRET_DIR
+.br
+.B ck add
+.I PROGRAM_NAME CONFIG_PATH
+.RB [ \-p ]
+.RB [ \-s ]
+.br
+.B ck delete
+.IR PROGRAM_NAME | \fR{\fB\-c \ \fICONFIG_PATH\fR}
+.br
+.B ck list
+.BR tree \ [ \-a ]
+.br
+.B ck list
+.RB { -p \ \fIPROGRAM_NAME\fR}\fR| programs | paths \ [ \-t
+.RB { plain | python | lisp } \fR]
+.RB [ \-a ]
+.br
+.B ck list ckconf
+.br
+.B ck edit
+.IR PROGRAM_NAME \ [ CONFIG_BASENAME ]
+.br
+.B ck search
+.I SEARCH_TERM
+.br
+.B ck restore
+.IR PROGRAM_NAME | \fBall
+.br
+.B ck help
+.I action
+.SH DESCRIPTION
+.B ck
+manages configuration files in a Linux system. To that end it provides an
+.B action
+based command line interface.
+.P
+.B ck
+needs a database and an rc file to run. It also needs two
+directories (stored in the rc file), the
+.I VERSION_CONRTOL_DIR
+and the
+.IR SECRET_DIR .
+This is where the configurations will end up after they are added to
+.BR ck .
+The
+.B init
+action takes care of them. For more details see the
+.BR ACTIONS \ and \ FILES
+sections below.
+.P
+In
+.B ck
+terms a
+.I program
+is an entity that has one or more
+.I configs
+attached to it. Each
+.I program
+can have exactly one
+.BI primary \ config \fR.
+Upon adding a
+.I config
+to
+.BR ck ,
+it is moved to the appropriate directory, and the symbolically linked
+back to it's original place (\fIln -s\fR).
+.P
+In a later time you can sync the
+.I VERSION_CONRTOL_DIR
+and
+.IR SECRET_DIR .
+You can also
+.B restore
+the links given these two directories and the correspondig rc file and database.
+.SH OPTIONS
+Change
+.B ck
+behaviour using the following options. They must be present before any
+.B action.
+.TP
+.B \-\-verbose\fR, \fB\-v
+[WIP]
+.br
+Currently prints the log. Must be the first argument in order to work.
+.TP
+.B \-\-config \fIDIR\fR, \fB\-c \fIDIR
+Use
+.BR ckdb \ and \ ckrc
+residing in
+.I DIR
+instead of the default
+.IR ~/.ck/ .
+.TP
+.B \-\-version\fR, \fBversion
+Print version and licence information, and quit.
+.SH ACTIONS
+Pass the action after any
+.BR OPTIONS .
+
+.SH EXIT STATUS
+.B ck
+shall return 0 if the action was completed without an error, -1 otherwise
+.SH FILES
+By default
+.B ck
+will store it's files in
+.IR ~/.ck/ .
+Using the
+.BR \-c | --config
+one can change this.
+.SS "ck generated files"
+.TP
+.I ~/.ck/ckrc
+Store the configuration values (\fIVERSION_CONTROL_DIR\fR and \fISECRET_DIR\fR).
+.TP
+.I ~/.ck/ckdb
+SQLite3 database.
+.SS "User files"
+.TP
+.I VERSION_CONTROL_DIR
+This is where the configuration files will end up by default. It's value is set with the
+.B init
+action, but can be changed by editing
+.IR ckrc .
+.TP
+.I SECRET_DIR
+This is where the configuration files will end up when adding them with the -s flag. It's value is set with the
+.B init
+action, but can be changed by editing
+.IR ckrc .
diff --git a/src/actionparser.c b/src/actionparser.c
index c4bfbc5..f04c1d5 100644
--- a/src/actionparser.c
+++ b/src/actionparser.c
@@ -25,9 +25,9 @@ const char* const strLIST[] = {"5", "list", "ls", "l", "-l", "-ls"};
const char* const strSEARCH[] = {"4", "search", "grep", "s", "-s"};
const char* const strHELP[] = {"5", "help", "h", "-?", "-h", "--help"};
const char* const strRESTORE[] = {"3", "restore","r", "-r"};
-const char* const strConfDir[] = {"2", "config", "-c"};
-const char* const strVersion[] = {"2", "version", "--version"};
+const char* const strConfDir[] = {"2", "--config", "-c"};
const char* const strVerbose1[] = {"2", "--verbose", "-v"};
+const char* const strVersion[] = {"2", "version", "--version"};
const char* const strVerbose2[] = {"2", "--Verbose", "-V"};
/* Number of opts */