You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario
The first thing a user should do immediately after installing romie, would be to initialize the configuration file. This file's location is the only one that cannot be changed. The configuration file will always be: ~/.romie/romie.conf. Inside this configuration file, there will be various things to tweak, such as the database file location, and others. Every single entry in that configuration file should be able to be edited in two ways:
Manually editing the file using a text editor
Using romie itself: for example, romie config set <option>
In this task, we will focus on the second approach, where the user would be able to modify the setting of romie, using romie., where each option would be a sub-command of config. As for the first option, we need to make sure the user hasn't damaged the file by inserting wrong configuration, syntax, or typos. To do that, we will introduce a check for the configuration using a sub-command check.
User Stories
Given you start using romie for the very first time, when you initialize the configuration file romie config init, then the configuration will be created under a default location in your system.
Given you have already initialized the configuration, when you type romie config, then you will the contents of the file.
Given you have already initialized the configuration, when you type romie config view db, then you will parse the configuration file and print it's db setting value.
Given you have already initialized the configuration, when you type romie config check, it will return OK if everything is seems healthy.
Given you have already initialized the configuration, when you type romie config clean, it will delete the configuration file. If you pass the --all flag it will also delete any other file (e.g. the database file).
Given you have modified the configuration of the db file, when you type romie config reset db it will move it to the default location.
Acceptance Criteria
Use the Cobra framework to create a romie config, romie config init, romie config check, romie config set db, and romie config view db.
Every command should come with their appropriate help
Write a functional test in the CI
For romie config check
Write a function that checks the configuration has been successfully created and if not return an error
Write a function that checks the configuration file is not damaged (e.g. Viper can read it)
Write a function that checks if romie can write and read the file
Write a unit test
Write a functional test
For romie config init
Create the configuration file at ~/.romie/romie.conf and populate it with default values, such set the db setting into ~/.romie/db.json.
Read a configuration file that will have a default location of the database file and create that file
If the configuration file already exists, return doing nothing, informing the user that romie has already been initialized.
Return any errors if there are any
Write unit tests
Write functional test in the CI
For romie config set db $arg
Write the path given as $arg into the value of the db setting into the configuration file.
Write a unit test
Write a functional test in the CI
For romie config clear
Removes the configuration file if any
Passing the --all flag will delete any other file that is listed in the configuration file (e.g. the db file)
For romie config reset db
Move the db file to the default location (~/.romie/db.json`)
Write functional test in the CI
For romie config view db
Returns the value of the db option into the configuration file
Write a unit test for return the content, making sure this is a db setting
Scenario
The first thing a user should do immediately after installing romie, would be to initialize the configuration file. This file's location is the only one that cannot be changed. The configuration file will always be:
~/.romie/romie.conf
. Inside this configuration file, there will be various things to tweak, such as the database file location, and others. Every single entry in that configuration file should be able to be edited in two ways:romie config set <option>
In this task, we will focus on the second approach, where the user would be able to modify the setting of romie, using romie., where each
option
would be asub-command
ofconfig
. As for the first option, we need to make sure the user hasn't damaged the file by inserting wrong configuration, syntax, or typos. To do that, we will introduce a check for the configuration using a sub-commandcheck
.User Stories
romie config init
, then the configuration will be created under a default location in your system.romie config
, then you will the contents of the file.romie config view db
, then you will parse the configuration file and print it's db setting value.romie config check
, it will return OK if everything is seems healthy.romie config clean
, it will delete the configuration file. If you pass the--all
flag it will also delete any other file (e.g. the database file).romie config reset db
it will move it to the default location.Acceptance Criteria
romie config
,romie config init
,romie config check
,romie config set db
, andromie config view db
.help
For
romie config check
For
romie config init
~/.romie/romie.conf
and populate it with default values, such set the db setting into~/.romie/db.json
.For
romie config set db $arg
$arg
into the value of thedb
setting into the configuration file.For
romie config clear
--all
flag will delete any other file that is listed in the configuration file (e.g. the db file)For
romie config reset db
For
romie config view db
For
romie config
Hints
The text was updated successfully, but these errors were encountered: