Skip to content

Commit

Permalink
Improve upload archive progress bar
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <michaelsv@jfrog.com>
  • Loading branch information
sverdlov93 committed Jan 8, 2025
1 parent 91f9a19 commit 0a734da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions artifactory/commands/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,19 @@ func NewSetupCommand(packageManager project.ProjectType) *SetupCommand {
}
}

// GetSupportedPackageManagersList returns a sorted list of supported package managers.
func GetSupportedPackageManagersList() []project.ProjectType {
// GetSupportedPackageManagersList returns a sorted list of supported package manager names as strings.
func GetSupportedPackageManagersList() []string {
allSupportedPackageManagers := maps.Keys(packageManagerToRepositoryPackageType)
// Sort keys based on their natural enum order
slices.SortFunc(allSupportedPackageManagers, func(a, b project.ProjectType) int {
return int(a) - int(b)
})
return allSupportedPackageManagers
// Convert enums to their string representation
result := make([]string, len(allSupportedPackageManagers))
for i, manager := range allSupportedPackageManagers {
result[i] = manager.String()
}
return result
}

func IsSupportedPackageManager(packageManager project.ProjectType) bool {
Expand Down
6 changes: 3 additions & 3 deletions artifactory/commands/setup/setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ func testBuildToolLoginCommandConfigureDotnetNuget(t *testing.T, packageManager

func TestGetSupportedPackageManagersList(t *testing.T) {
result := GetSupportedPackageManagersList()
// Check that Go is before Pip, and Pip is before Npm using GreaterOrEqual
assert.GreaterOrEqual(t, slices.Index(result, project.Pip), slices.Index(result, project.Go), "Go should come before Pip")
assert.GreaterOrEqual(t, slices.Index(result, project.Npm), slices.Index(result, project.Pip), "Pip should come before Npm")
// Check that "Go" is before "Pip", and "Pip" is before "Npm"
assert.GreaterOrEqual(t, slices.Index(result, project.Go.String()), slices.Index(result, project.Pip.String()), "Go should come before Pip")
assert.GreaterOrEqual(t, slices.Index(result, project.Pip.String()), slices.Index(result, project.Npm.String()), "Pip should come before Npm")
}

func TestIsSupportedPackageManager(t *testing.T) {
Expand Down

0 comments on commit 0a734da

Please sign in to comment.