-
Notifications
You must be signed in to change notification settings - Fork 102
Add rit update workspace
core command
#922
Add rit update workspace
core command
#922
Conversation
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks like it is on the right place
split := strings.Split(selected, " (") | ||
workspaceName := split[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a safer way of doing this? Maybe by the index on the list or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The List method returns an element like this: Default (/Users/username/ritchie-formulas-local)
Therefore this is the easiest way to get the workspace's name based on the user choice (as we don't know how he wrote the workspace's name when he added it).
We could eventually refactor the List method, but it would be necessary to change other core commands implementations. I suggest to do it as another improvement feature PR to not mix things.
Do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have thought of some workarounds that may be ok.
For instance, let us think that we have a workspace named Fernando (Test)
. With current implementation code will break, because split will give us 3 slices: Fernando
, Test)
and path
.
Hoping that the user does not use any spaces on directories, we can find workspaceName
by joining the recently split slice, but ignoring the last element, that should be the path.
Another approach is that instead of looking for the workspaceName
we always look for the workspacePath
by getting the last element of split
(and cleaning remaining closing brackets).
We check if it is a valid path, if true we join remaining slices in order to get workspaceName
.
If it is not a valid path we loop split
backwards, joining the elements until we get a valid workspacePath
.
What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any problem updating the way we list workspaces.
I just think it shouldn't be done in this PR as it will impact 2 others core commands (rit list workspace
and rit delete workspace
) as well as rit update workspace
.
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Codecov Report
@@ Coverage Diff @@
## master #922 +/- ##
==========================================
+ Coverage 85.55% 85.62% +0.07%
==========================================
Files 118 119 +1
Lines 4305 4375 +70
==========================================
+ Hits 3683 3746 +63
- Misses 417 420 +3
- Partials 205 209 +4
Continue to review full report at Codecov.
|
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
Signed-off-by: GuillaumeFalourd <guillaume.falourd@zup.com.br>
🚀 |
Description
rit update workspace
core command to allow users to update the workspacetree.json
file and access new formulas (or formulas' updates) after updating the workspace usinggit
commands.How to verify it
rit update workspace
commandDemo
rit.update.workspace.mp4
Changelog
rit update workspace
core command.Tasks
rit update workspace
command ritchie-docs#82