Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Cmd = &cobra.Command{ Use: "upload-worklogs /path/to/file.yml", Aliases: []string{"uw"}, Short: "Upload daily worklogs into Jira from JSON or YAML/YML files", Long: "Upload daily worklogs into Jira from JSON or YAML/YML files. " + "Only logs with the issue_key and the tag work are uploaded.", Args: func(cmd *cobra.Command, args []string) error { argsVal := NewArgsValidator(args) if err := argsVal.Validate(); err != nil { return err } return nil }, RunE: func(cmd *cobra.Command, args []string) error { path := args[0] errPath := fmt.Errorf("\nPath: %s\n", path) fileProvider := supportedExtensions[filepath.Ext(path)].provider location, errLocation := time.LoadLocation(os.Getenv("TZ")) if errLocation != nil { return errLocation } worklogs, errLoad := fileProvider.LoadAndValidate(path, location) if errLoad != nil { return fmt.Errorf("%w %w", errLoad, errPath) } if push { uploader := repo2.NewJiraUploader( os.Getenv("ATLASSIAN_URL"), os.Getenv("ATLASSIAN_USERNAME"), os.Getenv("ATLASSIAN_TOKEN"), ) errUpload := upload(uploader, worklogs, context.Background()) if errUpload != nil { return fmt.Errorf("%w %w", errUpload, errPath) } } else { slog.Info(fmt.Sprintf("[%v] READ ONLY", worklogs.Date)) for _, worklog := range worklogs.Worklogs { slog.Info(worklog.GetReport(worklogs.Date)) } } return nil }, } )
Functions ¶
This section is empty.
Types ¶
type ArgsValidator ¶
type ArgsValidator struct {
// contains filtered or unexported fields
}
func NewArgsValidator ¶
func NewArgsValidator(args []string) *ArgsValidator
func (*ArgsValidator) Validate ¶
func (argsVal *ArgsValidator) Validate() error
type FileProvider ¶
Click to show internal directories.
Click to hide internal directories.