git_c

package
v0.0.0-...-0e3b330 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commit = &cobra.Command{
	Use:     "commit",
	Aliases: []string{"c"},
	Short:   "Commit and push changes to the remote repository",
	Run: func(cmd *cobra.Command, args []string) {
		all, err := cmd.Flags().GetBool("all")
		xerr.ExitIfError(err)

		push, err := cmd.Flags().GetBool("push")
		xerr.ExitIfError(err)

		interactive, err := cmd.Flags().GetBool("interactive")
		xerr.ExitIfError(err)

		if all {
			repositories := slice_utils.Keys(cfg.Configuration().Git)
			for _, repository := range repositories {

				clog.UnderlineF("Checking {{ %s | blue }}", repository)

				golang.UpdateGo(repository)

				git.CommitDirectory(repository, interactive)

				if push {
					err := git.Push(repository)
					if err != nil {
						clog.Error(repository, "\n", err.Error())
					} else {
						clog.Infof("{{ Up to date with remote | green }}")
					}
				}
			}

		} else {

			directory := shell.CurrentDirectory()

			golang.UpdateGo(directory)

			git.CommitDirectory(directory, interactive)

			if push {
				err := git.Push(directory)
				if err != nil {
					clog.Error(directory, "\n", err.Error())
				} else {
					clog.Infof("{{ Up to date with remote | green }}")
				}
			}
		}
	},
}
View Source
var Git = &cobra.Command{
	Use:     "git",
	Aliases: []string{"g"},
}
View Source
var Ignore = &cobra.Command{
	Use:   "ignore",
	Short: "Create .gitignore file for the current directory",
	Run: func(cmd *cobra.Command, args []string) {
		git.GitignoreCreate(".")
	},
}
View Source
var Scan = &cobra.Command{
	Use:   "scan",
	Short: "Scan for git repositories",
	Run: func(cmd *cobra.Command, args []string) {
		clog.Info("{{Scanning for git repositories...|green}}")
		directory := shell.CurrentDirectory()
		git.Scan(directory)
		git.VerifyPaths()
	},
}

Functions

func ActionOption

func ActionOption(localDirectory string) (string, string)

func ChatGPT

func ChatGPT()

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL