Refactored main.go into cmd/jobsearch/main.go (in case separate commands are introduced later) which has required the options mechanism to change slightly as well as the logging.

This commit is contained in:
bwilliams committed 2026-10-09 09:29:42 +01:00
1 parent de3ebf68c5
commit 6436253629
14 files changed
+273 -224

No files matched your search

+5 -8
View File
@@ -17,14 +17,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package config
import (
"errors"
"fmt"
"log/slog"
"git.avsdev.uk/Go/job-search/internal/cli"
"github.com/spf13/cobra"
)
func commandShow() *cobra.Command {
func commandShow(opts *cli.Options) *cobra.Command {
cmd := &cobra.Command{
Use: "show",
Short: "Print config information",
@@ -37,9 +37,9 @@ func commandShow() *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
slog.Debug("config.show.Run")
conf, ok := cli.ConfigFromContext(cmd.Context())
if !ok {
return errors.New("no configuration loaded")
conf, err := opts.RunSetup(cmd, true, true)
if err != nil {
return fmt.Errorf("no configuration loaded (%w)", err)
}
if yaml, _ := cmd.Flags().GetBool("yaml"); yaml {
@@ -52,9 +52,6 @@ func commandShow() *cobra.Command {
return nil
},
Annotations: map[string]string{
"terminal_log": "1",
},
}
cmd.Flags().Bool("json", false, "format configuration as json")
cmd.Flags().Bool("yaml", false, "format configuration as yaml")