Commit 473b5bc7 authored by Clément OUDOT's avatar Clément OUDOT

Manage 4 levels in keys to use CLI for menu applications (#1494)

parent a116cf11
......@@ -105,6 +105,14 @@ sub addKey {
elsif ( $#path == 1 ) {
$new->{ $path[0] }->{ $path[1] }->{ $el->[1] } = $el->[2];
}
elsif ( $#path == 2 ) {
$new->{ $path[0] }->{ $path[1] }->{ $path[2] }->{ $el->[1] } =
$el->[2];
}
elsif ( $#path == 3 ) {
$new->{ $path[0] }->{ $path[1] }->{ $path[2] }->{ $path[3] }
->{ $el->[1] } = $el->[2];
}
else {
die $el->[0] . " has too many levels. Aborting";
}
......@@ -137,6 +145,13 @@ sub delKey {
elsif ( $#path == 1 ) {
delete $new->{ $path[0] }->{ $path[1] }->{ $el->[1] };
}
elsif ( $#path == 2 ) {
delete $new->{ $path[0] }->{ $path[1] }->{ $path[2] }->{ $el->[1] };
}
elsif ( $#path == 3 ) {
delete $new->{ $path[0] }->{ $path[1] }->{ $path[2] }->{ $path[3] }
->{ $el->[1] };
}
else {
die $el->[0] . " has too many levels. Aborting";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment