Answers
- Interfaces benefit us when writing modular code that’s decoupled and reduces dependency across different parts of the code base. Since we have an interface, it’s much easier to swap out the implementation. In the existing code, you’d swap the implementation type in the
Run
method of themetadata
package. - In this example:
./audiofile-cli upload -filename music.mp3
upload
, -filename
, and music.mp3
are all considered arguments. However, flags are specific arguments that are specifically marked by a specific syntax. In this case, -filename
is a flag.
- An additional test for when a user runs the
get
command without passing in any arguments or flags would look like this:{ name: "get - failure - missing required id flag", fields: fields{ ...