mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
50 lines
1.5 KiB
5 years ago
|
## flags
|
||
|
|
||
|
### Instructions
|
||
|
|
||
5 years ago
|
Write a **program** that can have as arguments `--insert` (or `-i`), `--order` (or `-o`) and a `string`.
|
||
5 years ago
|
|
||
|
This program should :
|
||
|
|
||
|
- Insert the string given to the `--insert` (or `-i`), in the `string` argument, if given.
|
||
5 years ago
|
- Order the `string` argument (in ASCII order) if given the flag `--order` (or `-o`).
|
||
5 years ago
|
- In case there are no arguments or the flag `--help` (or `-h`) is given, it should print the options, as shown in the example.
|
||
|
|
||
|
Example of output :
|
||
|
|
||
|
```console
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$ go build
|
||
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags --insert=4321 --order asdad
|
||
5 years ago
|
1234aadds
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags --insert=4321 asdad
|
||
5 years ago
|
asdad4321
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags asdad
|
||
5 years ago
|
asdad
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags --order 43a21
|
||
5 years ago
|
1234a
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags
|
||
5 years ago
|
--insert
|
||
|
-i
|
||
|
This flag inserts the string into the string passed as argument.
|
||
|
--order
|
||
|
-o
|
||
5 years ago
|
This flag will behave like a boolean, if it is called it will order the argument.
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$
|
||
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags -h
|
||
5 years ago
|
--insert
|
||
|
-i
|
||
|
This flag inserts the string into the string passed as argument.
|
||
|
--order
|
||
|
-o
|
||
5 years ago
|
This flag will behave like a boolean, if it is called it will order the argument.
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$
|
||
|
student@ubuntu:~/[[ROOT]]/flags$ ./flags --help
|
||
5 years ago
|
--insert
|
||
|
-i
|
||
|
This flag inserts the string into the string passed as argument.
|
||
|
--order
|
||
|
-o
|
||
5 years ago
|
This flag will behave like a boolean, if it is called it will order the argument.
|
||
5 years ago
|
student@ubuntu:~/[[ROOT]]/flags$
|
||
5 years ago
|
```
|