-
Notifications
You must be signed in to change notification settings - Fork 16
CCDB CLI
CCDB provides 'ccdb
' - command line interface for introspection and management of constants.
It can be used as interactive shell or to execute single commands.
Example. Single command:
(1) (2) (3)
ccdb -c "mysql://john@localhost:999" ls /TOF/params
-
-c
"mysql://john@localhost" - isccdb
global argument, which sets the connection string. -
ls
- is a ccdb command which (like a POSIX ls) prints a list of directories and tables belonging to/TOF/params
3/TOF/params
is an argument of thels
command.
Example. Interactive session:
ccdb -c "mysql://john@localhost:999" -i (1)
> ls /TOF/params (2)
> help (3)
> cd /TOF (4)
> cd params
> ls
> pwd (5)
> q (6)
-
flag
-i
startsccdb
in the interactive mode. -
ls /TOF/params
- the result is exactly the same as in the above example. -
help
command provides list of commands and how to use each of them -
ccdb interactive mode has a current working directory, with relative and absolute paths
-
Same as for POSIX shell,
pwd
command shows the current directory. -
to exit interactive mode enter
q
,quit
or press ctrl+D
Since ccdb objects have /name/paths and many other things that looks like POSIX file system, the commands are very posix-shell-like.
ccdb
command uses the connection strings to connect to data source.
The connection string should be provided by:
-
-c flag (as in the above example)
-
CCDB_CONNECTION environment variable
export CCDB_CONNECTION=mysql://[email protected]/ccdb
If no connection string is given by -c
or CCDB_CONNECTION
, then mysql://ccdb_user@localhost/ccdb
is used.
-c
flag has the highest priority
ccdb
is designed to be a self descriptive. By using 'help' 'usage' and 'example' commands
one could get all the commands and how to use them.
By using 'howto' command one could get tutorials for typical situations.
Command arguments are choosen to be consistant with other commands. Some flags and argument formats means the same across all commands. What are these flags? There are several types of "objects" in ccdb. Like directories, variation, run nuber. Some commands may be applied for different objects. For example 'info' command may be executed against directory, table or variation There are unified flags to identify objects for all commands:
- -v - Variation
- -t - Data table
- -r - Run or run-range
- -d - Directory
- -a - Assignment (usually identified by request or db ID)
ccdbcmd -i
> info -v default (1)
> info -r all (2)
> info -d /TOF (3)
> info -t /TOF/params (4)
> info /TOF/params (5)
- Get information about "default" variation
- Get information about "all" runrange. "all" runrange is [0, infinite_run]
- Get information about "/TOF" directory.
- Get information about "/TOF/params" type table
- By default 'info' treat non flag argument as a name of a table.
This table is printed if one executes "ccdb help"
(command) | (name) | (description): |
---|---|---|
add | AddData | Add data constants |
info | Info | Prints extended information about an object |
vers | Versions | Show versions of data for the specified table |
run | CurrentRun | gets or sets current working run |
dump | Dump | Dumps datat table to a file |
show | Show | Shows type table data |
mkdir | MakeDirectory | Create directory |
pwd | PrintWorkDir | Prints working directory |
cd | ChangeDir | Change current directory |
mktbl | MakeTable | Create constants type table |
cat | Cat | Show assignment data by ID |
ls | List | List objects in a given directory |
log | Log | Get CCDB changes log |
Assuming that user is in interactive mode, one may categorize the commands:
To navigate directories
-
pwd
- prints curent directory -
cd
- switch to specified directory -
ls
- list objects in the directory (wildcards are allowed) -
mkdir
- creates directory
> pwd
> cd /TOF
> ls
> mkdir constants
> ls con*
Get information about objects
-
info
- gets information about objects (use -v -r -d flags), see example 6. -
vers
- gets all versions of the table -
cat
- displays values -
dump
- same as cat but dumps files to disk -
log
- see logs information
Manage objects
-
mkdir
- creates directory -
mktbl
- creates data table -
add
- adds data from text file to table (variation and runranges are created automatically by add command)