-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #2903 from ActiveState/mitchell/dx-2334"
- Loading branch information
1 parent
85224ba
commit 98c0cde
Showing
584 changed files
with
3,125 additions
and
3,878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package captain | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/ActiveState/cli/internal/locale" | ||
) | ||
|
||
type NameVersion struct { | ||
name string | ||
version string | ||
} | ||
|
||
func (nv *NameVersion) Set(arg string) error { | ||
nameArg := strings.Split(arg, "@") | ||
nv.name = nameArg[0] | ||
if len(nameArg) == 2 { | ||
nv.version = nameArg[1] | ||
} | ||
if len(nameArg) > 2 { | ||
return locale.NewInputError("name_version_format_err", "Invalid format: Should be <name@version>") | ||
} | ||
return nil | ||
} | ||
|
||
func (nv *NameVersion) String() string { | ||
if nv.version == "" { | ||
return nv.name | ||
} | ||
return fmt.Sprintf("%s@%s", nv.name, nv.version) | ||
} | ||
|
||
func (nv *NameVersion) Name() string { | ||
return nv.name | ||
} | ||
|
||
func (nv *NameVersion) Version() string { | ||
return nv.version | ||
} |
Oops, something went wrong.