Skip to content

Commit

Permalink
Revert "feat: Display packages in ok pkg install --interactive (#278)"
Browse files Browse the repository at this point in the history
This reverts commit de8af27.
  • Loading branch information
yngvark committed Oct 25, 2024
1 parent afc7fa4 commit 94fbac2
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 149 deletions.
27 changes: 2 additions & 25 deletions pkg/pkg/install/interactive/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ import (
"github.com/oslokommune/ok/pkg/pkg/common"
)

const (
outputFolderWidth = 45
templateWidth = 40
varFilesWidth = 80
)

func SelectPackagesToInstall(pkgManifestFilename string) ([]string, error) {
manifest, err := common.LoadPackageManifest(pkgManifestFilename)
if err != nil {
Expand All @@ -21,11 +15,8 @@ func SelectPackagesToInstall(pkgManifestFilename string) ([]string, error) {

options := make([]huh.Option[string], 0)

for _, pkg := range manifest.Packages {
displayText := createDisplayText(pkg)
value := pkg.OutputFolder

options = append(options, huh.NewOption[string](displayText, value))
for _, p := range manifest.Packages {
options = append(options, huh.NewOption(p.OutputFolder, p.OutputFolder))
}

var packages []string
Expand All @@ -47,17 +38,3 @@ func SelectPackagesToInstall(pkgManifestFilename string) ([]string, error) {

return packages, nil
}

func createDisplayText(pkg common.Package) string {
/*
Format specifiers explained:
%-*.*s formats a string with a specified width and precision.
- The first * sets the minimum width, padding with spaces if shorter.
- The second * sets the maximum length, truncating if longer.
*/
outputFolder := fmt.Sprintf("%-*.*s", outputFolderWidth, outputFolderWidth, pkg.OutputFolder)
template := fmt.Sprintf("%-*.*s", templateWidth, templateWidth, pkg.Template)
varFiles := fmt.Sprintf("%-*.*s", varFilesWidth, varFilesWidth, fmt.Sprint(pkg.VarFiles))

return fmt.Sprintf("%s %s %s", outputFolder, template, varFiles)
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions test/github-actions/config/packages.yml

This file was deleted.

6 changes: 0 additions & 6 deletions test/terraform/packages.yml → test/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,3 @@ Packages:
VarFiles:
- "config/common-config.yml"
- "config/networking.yml"
- Template: "networking"
Ref: "main"
OutputFolder: "out/networking2"
VarFiles:
- "config/common-config.yml"
- "config/networking.yml"
4 changes: 0 additions & 4 deletions test/terraform/config/common-config.yml

This file was deleted.

0 comments on commit 94fbac2

Please sign in to comment.