Documentation
¶
Overview ¶
Package status provides the command to show git status.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var StatusCmd = &cobra.Command{ Use: "status", Example: ` contextvibes factory status`, Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr()) ctx := cmd.Context() workDir, err := os.Getwd() if err != nil { return fmt.Errorf("failed to get working directory: %w", err) } gitCfg := git.GitClientConfig{ Logger: globals.AppLogger, Executor: globals.ExecClient.UnderlyingExecutor(), } client, err := git.NewClient(ctx, workDir, gitCfg) if err != nil { return fmt.Errorf("failed to initialize git client: %w", err) } stdout, _, err := client.GetStatusShort(ctx) if err != nil { return fmt.Errorf("failed to get git status: %w", err) } trimmedStdout := strings.TrimSpace(stdout) if trimmedStdout == "" { presenter.Info("Working tree is clean.") } else { presenter.InfoPrefixOnly() fmt.Fprintln(presenter.Out(), " Current Changes (--short format):") scanner := bufio.NewScanner(strings.NewReader(trimmedStdout)) for scanner.Scan() { fmt.Fprintf(presenter.Out(), " %s\n", scanner.Text()) } presenter.Newline() } return nil }, }
StatusCmd represents the status command.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.