Menu

20 | cimit Syntax and test cases

Test cases

% 
% # country directory
% 
% cimit list countries
% cimit add country France
% cimit add country 'Russian Federation'
% cimit list countries
France
Russian Federation
% cimit rename country 'Russian Federation' Russia
% cimit list countries
France
Russia
% cimit delete country France
% cimit list countries
Russia
% cimit add country France
% cimit add country France
cimit: France is already in the list
% cimit rename country France Russia
cimit: Russia is already in the list
% cimit list countries
Russia
France
% ls /var/games/cimit/struct
France  Russia
% 
% # organizations structure
% 
% cimit add org UN # global organization
% cimit add orgs UN
cimit: UN is already exists
% cimit add dept Center
% cimit add depts Center
cimit: Center is already exists
% cimit add dept Comission Center # add department
% cimit add dept 'Section 1' Comission Center # located dept
% cimit list countries
Russia
France
% cimit add dept 'Section 3' Comission Romania # auto add country
% cimit list countries
Russia
France
Romania
% cimit list depts # all first level
1   UN       -
2   Center   -
% cimit recurse depts # all hier
<GLOBAL>:
1   UN
2   Center:
    3   Comission
        4   Section 1   France
        5   Section 3   Romania
% cimit add dept Section\ 1 CIA USA # auto add located org
% cimit list depts
1   UN       -
2   Center   -
6   CIA      USA
% cimit recurse depts
<GLOBAL>:
1   UN
2   Center:
    3   Comission:
        4   Section 1   France
        5   Section 3   Romania
USA:
6   CIA
    7   Section 1
% cimit list depts - # only global depts
1   UN       -
2   Center   -
% cimit add dept 'Section 1' CIA Romania
cimit: CIA already has got Section 1 dept
% cimit recurse depts - # depts of only global orgs
<GLOBAL>:
1   UN
2   Center:
    3   Comission:
        4   Section 1   France
        5   Section 3   Romania
% cimit add org Interpol # auto add global org
% cimit list depts -
1   UN         -
2   Center     -
8   Interpol   -
% 
% # person directory
% 
% ls /var/games/cimit/people
% cimit add man 'Marcelo Raymond'
% cimit add woman 'Sarah Salvador'
% ls /var/games/cimit/people
1 2
% cat /var/games/cimit/people/1
name:Marcelo Raymond
gender:male
condition:alive
% cimit view person 'Sarah Salvador'
Person code 2
Name        Sarah Salvador
Gender      female
Condition   alive
% cimit view person 2
Person code 2
Name        Sarah Salvador
Gender      female
Condition   alive
% cimit add person 3
cimit: 3 is not a valid person name
% cimit get person condition 'Sarah Salvador'
alive
% cimit get person name 1
Marcelo Raymond
% cimit get person name 3
% cimit add person 'Marcelo Raymond'
% cimit get person name 3
Marcelo Raymond
% cimit get person gender 3
male
% cimit get woman condition 'Marcelo Raymond'
alive
alive
% cimit edit person condition dead 'Marcelo Raymond'
cimit: there are several persons named Marcelo Raymond, use person code
% cimit get person code 'Marcelo Raymond'
1
3
% cimit edit person condition dead 3
% cimit get person condition 'Marcelo Raymond'
alive
dead
% cimit get person condition 3
dead
% cimit get person condition 1
alive
% cimit edit person code 3 4
cimit: code is the system field, it can not be edited
% cimit edit woman test_field 'some value' 'Sarah Salvador'
% cimit get woman test_field 2
some value

Scripts structure

/usr/local/sbin/cimit (1030) % ls -RFl
total 12
-rwxr-xr-x  1 nostoc  wheel    0 17 ноя 08:35 cimit*
lrwxr-xr-x  1 nostoc  wheel    7 17 ноя 08:32 countries@ -> country
drwxr-xr-x  2 nostoc  wheel  512 17 ноя 08:31 country/
lrwxr-xr-x  2 nostoc  wheel  512 17 ноя 08:34 department@ -> org
lrwxr-xr-x  1 nostoc  wheel   10 17 ноя 08:35 departments@ -> department
drwxr-xr-x  2 nostoc  wheel  512 17 ноя 08:33 org/
lrwxr-xr-x  1 nostoc  wheel    3 17 ноя 08:34 orgs@ -> org

./country:
total 0
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:30 add*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:31 delete*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:31 list*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:31 rename*

./department:
total 0
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:34 add*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:34 delete*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:34 list*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:34 rename*

./org:
total 0
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:33 add*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:33 delete*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:33 list*
-rwxr-xr-x  1 nostoc  wheel  0 17 ноя 08:33 rename*
/usr/local/sbin/cimit (1031) % 

Data structure

/var/games/cimit/

Posted by Ivan Bilimov 2015-11-23

Log in to post a comment.