mirror of https://github.com/01-edu/public.git
fix(ascii-art): fixing the way to use the flag on the optional projects
This commit is contained in:
parent
50ae92c2bd
commit
b11528ec4b
|
@ -4,19 +4,19 @@
|
|||
|
||||
You must follow the same [instructions](../README.md) as in the first subject but this time with colors.
|
||||
|
||||
The output should manipulate colors using the **flag** `--color=<color>`, in which `--color` is the flag and `<color>` is the color desired by the user. These colors can be achieved using different notations (color code systems, like `RGB`, `hsl`, `ANSI`...), it is up to you to choose which one you want to use.
|
||||
The output should manipulate colors using the **flag** `--color=<color> <letters to be colored>`, in which `--color` is the flag and `<color>` is the color desired by the user and `<letters to be colored>` is the letter or letters that you can chose to be colored. These colors can be achieved using different notations (color code systems, like `RGB`, `hsl`, `ANSI`...), it is up to you to choose which one you want to use.
|
||||
|
||||
- You should be able to choose between coloring a single letter or a set of letters (use your imagination for this one).
|
||||
- You should be able to choose between coloring a single letter or a set of letters.
|
||||
- If the letter is not specified, the whole `string` should be colored.
|
||||
- The flag must have exactly the same format as above, any other formats must return the following usage message:
|
||||
|
||||
```console
|
||||
Usage: go run . [STRING] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING]
|
||||
|
||||
EX: go run . something --color=<color>
|
||||
EX: go run . --color=<color> <letters to be colored> "something"
|
||||
```
|
||||
|
||||
If there are other `ascii-art` optional projects implemented, the program should accept other correctly formatted `[OPTION]` and/or `[BANNER]`.
|
||||
If there are other `ascii-art` optional projects implemented, the program should accept other correctly formatted `[OPTION]` and/or `[BANNER]`.
|
||||
Additionally, the program must still be able to run with a single `[STRING]` argument.
|
||||
|
||||
### Instructions
|
||||
|
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
###### Has the requirement for the allowed packages been respected? (Reminder for this project: only [standard packages](https://golang.org/pkg/))
|
||||
|
||||
##### Try passing as arguments `"banana" --color red`.
|
||||
##### Try passing as arguments `--color red "banana" `.
|
||||
|
||||
```
|
||||
Usage: go run . [STRING] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING]
|
||||
|
||||
EX: go run . something --color=<color>
|
||||
EX: go run . --color=<color> <letters to be colored> "something"
|
||||
```
|
||||
|
||||
###### Does it display the same result as above?
|
||||
|
||||
##### Try passing as arguments `"hello world" --color=red`.
|
||||
##### Try passing as arguments `--color=red "hello world"`.
|
||||
|
||||
###### Does it display the expected result?
|
||||
|
||||
##### Try passing as arguments `"1 + 1 = 2" --color=green`.
|
||||
##### Try passing as arguments `--color=green "1 + 1 = 2"`.
|
||||
|
||||
###### Does it display the expected result?
|
||||
|
||||
##### Try passing as arguments `"(%&) ??" --color=yellow`.
|
||||
##### Try passing as arguments `--color=yellow "(%&) ??"`.
|
||||
|
||||
###### Does it display the expected result?
|
||||
|
||||
|
@ -36,11 +36,11 @@ EX: go run . something --color=<color>
|
|||
|
||||
###### Does it display the expected result (the corresponding set of letters with that color)?
|
||||
|
||||
##### Try passing as arguments `"HeY GuYs" --color=orange`, in order to color `GuYs`.
|
||||
##### Try passing as arguments `--color=orange "HeY GuYs"`, in order to color `GuYs`.
|
||||
|
||||
###### Does it display the expected result?
|
||||
|
||||
##### Try passing as arguments `"RGB()" --color=blue`, in order to color just the B.
|
||||
##### Try passing as arguments `--color=blue "RGB()"`, in order to color just the `B`.
|
||||
|
||||
###### Does it display the expected result?
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ $ go run . "hello" standard | cat -e
|
|||
|_| |_| \___| |_| |_| \___/ $
|
||||
$
|
||||
$
|
||||
|
||||
$ go run . "Hello There!" shadow | cat -e
|
||||
$
|
||||
_| _| _| _| _|_|_|_|_| _| _| $
|
||||
|
@ -43,8 +44,6 @@ _| _| _|_|_| _| _| _|_| _| _| _| _|_|_| _| _
|
|||
$
|
||||
$
|
||||
|
||||
|
||||
|
||||
$ go run . "Hello There!" thinkertoy | cat -e
|
||||
$
|
||||
o o o o o-O-o o o $
|
||||
|
|
|
@ -22,9 +22,9 @@ To change the alignment of the output it must be possible to use a **flag** `--a
|
|||
- The flag must have exactly the same format as above, any other formats must return the following usage message:
|
||||
|
||||
```console
|
||||
Usage: go run . [STRING] [BANNER] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING] [BANNER]
|
||||
|
||||
Example: go run . something standard --align=right
|
||||
Example: go run . --align=right something standard
|
||||
```
|
||||
|
||||
If there are other `ascii-art` optional projects implemented, the program should accept other correctly formatted `[OPTION]` and/or `[BANNER]`.
|
||||
|
@ -41,7 +41,7 @@ Additionally, the program must still be able to run with a single `[STRING]` arg
|
|||
Assume the bars in the display below are the terminal borders:
|
||||
|
||||
```console
|
||||
|$ go run . "hello" standard --align=center |
|
||||
|$ go run . --align=center "hello" standard |
|
||||
| _ _ _ |
|
||||
| | | | | | | |
|
||||
| | |__ ___ | | | | ___ |
|
||||
|
@ -50,7 +50,7 @@ Assume the bars in the display below are the terminal borders:
|
|||
| |_| |_| \___| |_| |_| \___/ |
|
||||
| |
|
||||
| |
|
||||
|$ go run . "Hello There" standard --align=left |
|
||||
|$ go run . --align=left "Hello There" standard |
|
||||
| _ _ _ _ _______ _ |
|
||||
|| | | | | | | | |__ __| | | |
|
||||
|| |__| | ___ | | | | ___ | | | |__ ___ _ __ ___ |
|
||||
|
@ -59,7 +59,7 @@ Assume the bars in the display below are the terminal borders:
|
|||
||_| |_| \___| |_| |_| \___/ |_| |_| |_| \___| |_| \___| |
|
||||
| |
|
||||
| |
|
||||
|$ go run . "hello" shadow --align=right |
|
||||
|$ go run . --align=right "hello" shadow |
|
||||
| |
|
||||
| _| _| _| |
|
||||
| _|_|_| _|_| _| _| _|_| |
|
||||
|
@ -68,7 +68,7 @@ Assume the bars in the display below are the terminal borders:
|
|||
| _| _| _|_|_| _| _| _|_| |
|
||||
| |
|
||||
| |
|
||||
|$ go run . "how are you" shadow --align=justify |
|
||||
|$ go run . --align=justify "how are you" shadow |
|
||||
| |
|
||||
|_| |
|
||||
|_|_|_| _|_| _| _| _| _|_|_| _| _|_| _|_| _| _| _|_| _| _| |
|
||||
|
|
|
@ -2,61 +2,61 @@
|
|||
|
||||
###### Has the requirement for the allowed packages been respected? (Reminder for this project: only [standard packages](https://golang.org/pkg/))
|
||||
|
||||
##### Try passing as arguments `something standard --align right`
|
||||
##### Try passing as arguments `--align right something standard`
|
||||
|
||||
```
|
||||
Usage: go run . [STRING] [BANNER] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING] [BANNER]
|
||||
|
||||
Example : go run . something standard --align=right
|
||||
Example: go run . --align=right something standard
|
||||
```
|
||||
|
||||
###### Does it display the same result as above?
|
||||
|
||||
##### Try passing as arguments `left standard --align=right`
|
||||
##### Try passing as arguments `--align=right left standard`
|
||||
|
||||
###### Does it display the correct result at the right side?
|
||||
|
||||
##### Try passing as arguments `right standard --align=left`
|
||||
##### Try passing as arguments `--align=left right standard `
|
||||
|
||||
###### Does it display the correct result at the left side?
|
||||
|
||||
##### Try passing as arguments `hello shadow --align=center`
|
||||
##### Try passing as arguments `--align=center hello shadow`
|
||||
|
||||
###### Does it display the correct result at the center?
|
||||
|
||||
##### Try passing as arguments `"1 Two 4" shadow --align=justify`
|
||||
##### Try passing as arguments `"--align=justify 1 Two 4" shadow`
|
||||
|
||||
###### Does it display the correct result justified?
|
||||
|
||||
##### Try passing as arguments `23/32 standard --align=right`
|
||||
##### Try passing as arguments `--align=right 23/32 standard`
|
||||
|
||||
###### Does it display the correct result at the right side?
|
||||
|
||||
##### Try passing as arguments `ABCabc123 thinkertoy --align=right`
|
||||
##### Try passing as arguments `--align=right ABCabc123 thinkertoy`
|
||||
|
||||
###### Does it display the correct result at the right side?
|
||||
|
||||
##### Try passing as arguments `#$%&\" thinkertoy --align=center`
|
||||
##### Try passing as arguments `--align=center #$%&\" thinkertoy`
|
||||
|
||||
###### Does it display the correct result at the center?
|
||||
|
||||
##### Try passing as arguments `"23Hello World\!" standard --align=left`
|
||||
##### Try passing as arguments `--align=left "23Hello World\!" standard `
|
||||
|
||||
###### Does it display the correct result at the left side?
|
||||
|
||||
##### Try passing as arguments `"HELLO there HOW are YOU?\!" thinkertoy --align=justify`
|
||||
##### Try passing as arguments `--align=justify "HELLO there HOW are YOU?\!" thinkertoy`
|
||||
|
||||
###### Does it display the correct result justified?
|
||||
|
||||
##### Try passing as arguments `"a -> A b -> B c -> C" shadow --align=right`
|
||||
##### Try passing as arguments `--align=right "a -> A b -> B c -> C" shadow `
|
||||
|
||||
###### Does it display the correct result at the right side?
|
||||
|
||||
##### Try reducing the terminal window and run `abcd shadow --align=right`
|
||||
##### Try reducing the terminal window and run `--align=right abcd shadow `
|
||||
|
||||
###### Does the representation adapt to the terminal size displaying the right result in the right side?
|
||||
|
||||
##### Try reducing the terminal window and run `ola standard --align=center`
|
||||
##### Try reducing the terminal window and run `--align=center ola standard `
|
||||
|
||||
###### Does the representation adapt to the terminal size displaying the right result in the center?
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ The file must be named by using the flag `--output=<fileName.txt>`, in which `--
|
|||
- The flag must have exactly the same format as above, any other formats must return the following usage message:
|
||||
|
||||
```console
|
||||
Usage: go run . [STRING] [BANNER] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING] [BANNER]
|
||||
|
||||
EX: go run . something standard --output=<fileName.txt>
|
||||
EX: go run . --output=<fileName.txt> something standard
|
||||
```
|
||||
|
||||
If there are other `ascii-art` optional projects implemented, the program should accept other correctly formatted `[OPTION]` and/or `[BANNER]`.
|
||||
|
@ -26,7 +26,7 @@ Additionally, the program must still be able to run with a single `[STRING]` arg
|
|||
### Usage
|
||||
|
||||
```console
|
||||
$ go run . "hello" standard --output=banner.txt
|
||||
$ go run . --output=banner.txt "hello" standard
|
||||
$ cat -e banner.txt
|
||||
_ _ _ $
|
||||
| | | | | | $
|
||||
|
@ -37,7 +37,7 @@ $ cat -e banner.txt
|
|||
$
|
||||
$
|
||||
$
|
||||
$ go run . "Hello There!" shadow --output=banner.txt
|
||||
$ go run . --output=banner.txt "Hello There!" shadow
|
||||
$ cat -e banner.txt
|
||||
$
|
||||
_| _| _| _| _|_|_|_|_| _| _| $
|
||||
|
|
|
@ -2,17 +2,21 @@
|
|||
|
||||
###### Has the requirement for the allowed packages been respected? (Reminder for this project: only [standard packages](https://golang.org/pkg/))
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
##### Try passing as arguments `"banana" standard --output test00.txt`
|
||||
=======
|
||||
##### Try passing as arguments `"--output test00.txt banana standard "`
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
```
|
||||
Usage: go run . [STRING] [BANNER] [OPTION]
|
||||
Usage: go run . [OPTION] [STRING] [BANNER]
|
||||
|
||||
Example: go run . something standard --output=<fileName.txt>
|
||||
Example: go run . --output=<fileName.txt> something standard
|
||||
```
|
||||
|
||||
###### Does it display the same result as above?
|
||||
|
||||
##### Try passing as arguments `"First\nTest" shadow --output=test00.txt`
|
||||
##### Try passing as arguments `--output=test00.txt "First\nTest" shadow`
|
||||
|
||||
```
|
||||
student$ cat test00.txt
|
||||
|
@ -37,7 +41,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"hello" standard --output=test01.txt`
|
||||
##### Try passing as arguments `--output=test01.txt "hello" standard`
|
||||
|
||||
```
|
||||
student$ cat test01.txt
|
||||
|
@ -54,7 +58,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"123 -> #$%" standard --output=test02.txt`
|
||||
##### Try passing as arguments `--output=test02.txt "123 -> #$%" standard`
|
||||
|
||||
```
|
||||
student$ cat test02.txt
|
||||
|
@ -71,7 +75,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"432 -> #$%&@" shadow --output=test03.txt`
|
||||
##### Try passing as arguments `--output=test03.txt "432 -> #$%&@" shadow`
|
||||
|
||||
```
|
||||
student$ cat test03.txt
|
||||
|
@ -88,7 +92,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"There" shadow --output=test04.txt`
|
||||
##### Try passing as arguments `--output=test04.txt "There" shadow`
|
||||
|
||||
```
|
||||
student$ cat test04.txt
|
||||
|
@ -105,7 +109,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"123 -> \"#$%@" thinkertoy --output=test05.txt`
|
||||
##### Try passing as arguments `--output=test05.txt "123 -> \"#$%@" thinkertoy`
|
||||
|
||||
```
|
||||
student$ cat test05.txt
|
||||
|
@ -122,7 +126,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"2 you" thinkertoy --output=test06.txt`
|
||||
##### Try passing as arguments `--output=test06.txt "2 you" thinkertoy`
|
||||
|
||||
```
|
||||
student$ cat test06.txt
|
||||
|
@ -139,7 +143,7 @@ $
|
|||
|
||||
###### Does it save the right output in the right file?
|
||||
|
||||
##### Try passing as arguments `"Testing long output!" standard --output=test07.txt`
|
||||
##### Try passing as arguments `--output=test07.txt "Testing long output!" standard`
|
||||
|
||||
```
|
||||
student$ cat test07.txt
|
||||
|
|
Loading…
Reference in New Issue