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 <[email protected]>
  • Loading branch information
sverdlov93 committed Nov 21, 2024
1 parent 5f8e0aa commit 43d1a80
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions artifactory/commands/packagemanagerlogin/packagemanagerlogin.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import (
"github.com/jfrog/jfrog-client-go/artifactory/services"
"github.com/jfrog/jfrog-client-go/utils/errorutils"
"github.com/jfrog/jfrog-client-go/utils/log"
"golang.org/x/exp/maps"
"net/url"
"sort"
)

// PackageManagerToRepositoryPackageType maps project types to corresponding Artifactory repository package types.
var PackageManagerToRepositoryPackageType = map[project.ProjectType]string{
// packageManagerToRepositoryPackageType maps project types to corresponding Artifactory repository package types.
var packageManagerToRepositoryPackageType = map[project.ProjectType]string{
// Npm package managers
project.Npm: repository.Npm,
project.Yarn: repository.Npm,
Expand Down Expand Up @@ -65,10 +67,19 @@ func NewPackageManagerLoginCommand(packageManager project.ProjectType) *PackageM
}
}

// GetSupportedPackageManagersList returns a sorted list of supported package managers.
func GetSupportedPackageManagersList() []project.ProjectType {
allSupportedPackageManagers := maps.Keys(packageManagerToRepositoryPackageType)
sort.Slice(allSupportedPackageManagers, func(i, j int) bool {
return allSupportedPackageManagers[i] < allSupportedPackageManagers[j]
})
return allSupportedPackageManagers
}

// packageManagerToPackageType maps project types to corresponding Artifactory package types (e.g., npm, pypi).
func packageManagerToPackageType(packageManager project.ProjectType) (string, error) {
// Retrieve the package type from the map.
if packageType, exists := PackageManagerToRepositoryPackageType[packageManager]; exists {
if packageType, exists := packageManagerToRepositoryPackageType[packageManager]; exists {
return packageType, nil
}
// Return an error if the package manager is unsupported.
Expand Down

0 comments on commit 43d1a80

Please sign in to comment.