-
Notifications
You must be signed in to change notification settings - Fork 39
Client command format guidlines
This page shows the design principles for the cli command format and should therefore be read when implementing new features for the cli client.
The following structure is used for ALL commands.
hkn <entity> <action> <args>
where hkn
is the binary, entity
refers to the entity type, action
the action to and args
the required and optional arguments for the entity
and action
pair.
Note that the available actions are dependent on the selected entity, and the available arguments are dependent on the selected entity and action.
Examples of entities are as follows:
hkn user ...
hkn exercise ...
hkn event ...
Examples of actions are as follows:
hkn user create ...
hkn exercise reset ...
hkn event list ...
hkn group list ...
The required and optional arguments vary per entity and action pair. However, use the following principles:
- When an identifier refers to the entity in the command, it must be a required argument.
For illustration, the
sql
identifier refers to theexercise
entity:
hkn exercise update sql
- When an identifier does not refer to the entity in the command, it need to be specified as a flag.
In the following example, the
sql
exercise must be reset for groupgroup1
from eventevent1
. Note that this principle holds for both required and optional arguments.
hkn exercise reset sql -e event1 -g group1
We use the following identifiers
Entity | Identifier |
---|---|
event |
Each event has a subdomain that is used to route traffic by Haaukins . This subdomain is used as an event's identifier. |
exercise |
In the exercise definition file, each exercise has a tag list, and these tags can be used to identify exercises in the cli. |
group |
A unique identifier will be generated for groups. In order to get a group's identifier, use a list command (see example below). |
List all groups in the event ev1
:
$ hkn group list -ev ev1
GROUP ID NAME EMAIL
f58a13m BestTeam kh@es.aau.dk
jg018do WorstTeam tkp@es.aau.dk
Create a new event called event1
with tag ev1
$ hkn event create event1 -t ev1
Reset the SQL injection exercise for group BestTeam
in event ev1
.
$ hkn exercise reset sql -e ev1 -g f58a13m
Resetting exercises..
Done!