-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updated status printer with indentions
- Loading branch information
Showing
8 changed files
with
75 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,5 +64,6 @@ status.`) | |
workPackagesCmd, | ||
activitiesCmd, | ||
statusCmd, | ||
typesCmd, | ||
) | ||
} |
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,22 @@ | ||
package list | ||
|
||
import ( | ||
"github.com/opf/openproject-cli/components/printer" | ||
"github.com/opf/openproject-cli/components/resources/types" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var typesCmd = &cobra.Command{ | ||
Use: "types", | ||
Short: "Lists work package types", | ||
Long: "Get a list of all work package types of the instance.", | ||
Run: listTypes, | ||
} | ||
|
||
func listTypes(_ *cobra.Command, _ []string) { | ||
if all, err := types.All(); err == nil { | ||
printer.Types(all) | ||
} else { | ||
printer.Error(err) | ||
} | ||
} |
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
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,20 @@ | ||
package types | ||
|
||
import ( | ||
"github.com/opf/openproject-cli/components/parser" | ||
"github.com/opf/openproject-cli/components/paths" | ||
"github.com/opf/openproject-cli/components/requests" | ||
"github.com/opf/openproject-cli/dtos" | ||
"github.com/opf/openproject-cli/models" | ||
) | ||
|
||
func All() ([]*models.Type, error) { | ||
query := requests.NewPagedQuery(-1, nil) | ||
response, err := requests.Get(paths.Types(), &query) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
element := parser.Parse[dtos.TypeCollectionDto](response) | ||
return element.Convert(), nil | ||
} |