func gitIgnoreRun()

in cobra/controller/gitignore.go [77:106]


func gitIgnoreRun(cmd *cobra.Command, args []string) error {
	logrus.Traceln("start: command gitignore run")

	if len(args) > 0 && args[0] == "list" {
		list := aid.GetGitIgnoreList()
		if list == "" {
			return fmt.Errorf("unable to get gitignore list")
		}

		cmd.Println(list)
	} else {
		input, err := cmd.Flags().GetString("input")
		if err != nil {
			return err
		}

		downloaded, err := aid.DownloadGitIgnore(cmd, input)
		if err != nil {
			logrus.Errorf("unable to download gitignore\n%v", err)
			return err
		}

		if downloaded {
			cmd.Println(".gitignore created successfully")
		}
	}

	logrus.Traceln("end: command gitignore run")
	return nil
}