holo-routing / holo-cli

`holo` Command Line Interface
MIT License
1 stars 2 forks source link

`holo-cli` should not move to on to a wrong "token" #3

Open frederic-loui opened 5 months ago

frederic-loui commented 5 months ago

When trying to apply wrong IPv4 address for example holo-cli should not add the wrong token (and thus update the prompt):

holo(config)# interfaces interface eth3
holo(config/interface[eth3])# ipv4 enabled true
holo(config/interface[eth3])# ipv4 address 1.2.3.455 prefix-length 24
% failed to edit configuration: Unsatisfied pattern - "1.2.3.455" does not conform to "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?".
holo(config/interface[eth3]/address[1.2.3.455])#

The message could be more human/user friendly:

% failed to edit configuration: Unsatisfied pattern - "1.2.3.455" does not conform to "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?".

It can be for example:

% error: invalid ipv4 format