commands

package
v0.0.0-...-c057bff Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// keyword for alias gen
	AliasKeyword = "ALIASGEN:"
	// escape word to not include in alias file
	NoAliasEsc = "noalias"
)

Variables

View Source
var (
	AMonthCoorX = "46.225574"
	AMonthCoorY = "6.6202736"
)

TODO seperate all coordinates

View Source
var (
	CalUtil = &cobra.Command{
		Use:   "calutil",
		Short: "calendar utilities",
	}
	RipDays = &cobra.Command{
		Use:   "ripdays <YYYY-MM-DD> <YYYY-MM-DD>",
		Short: "print a rip daily calendar between the specified dates inclusive",
		Args:  cobra.ExactArgs(2),
		RunE:  RipDaysCmd,
	}
)

speedy todolists

View Source
var (
	CSVCmd = &cobra.Command{
		Use:   "csv",
		Short: "csv processing commands",
	}
	LastColOnlyCmd = &cobra.Command{
		Use:   "last-col-only [read-file] [write-file]",
		Short: "make each line only the last column",
		Args:  cobra.ExactArgs(2),
		RunE:  lastColOnlyCmd,
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var (
	FileCmd = &cobra.Command{
		Use:   "file",
		Short: "file processing commands",
	}
	MirrorCmd = &cobra.Command{
		Use:   "mirror [prefix] [suffix]",
		Short: "mirror files with a number in them",
		Args:  cobra.ExactArgs(2),
		RunE:  mirrorCmd,
	}
	CombineCmd = &cobra.Command{
		Use:   "combine [newfilename]",
		Short: "combines all files in the current directory into one file (concat all text)",
		Args:  cobra.ExactArgs(1),
		RunE:  combineCmd,
	}
)

file commands

View Source
var (
	SetPullCmd = &cobra.Command{
		Use:   "set-pull",
		Short: "GIT: set the pull to origin upstream head",
		RunE:  setPullCmd,
	}
	AddCommitPushCmd = &cobra.Command{
		Use:   "acp [message]",
		Short: "GIT: add -u, commit -m [message], push origin [cur branch]",
		Args:  cobra.ExactArgs(1),
		RunE:  addCommitPushCmd,
	}
	DuplicateCmd = &cobra.Command{
		Use:   "dup",
		Short: "duplicate the repo to [thisreponame]2",
		RunE:  duplicateCmd,
	}
	RmDuplicateCmd = &cobra.Command{
		Use:   "rm-dup",
		Short: "remove the duplicate the repo [thisreponame]2",
		RunE:  rmDuplicateCmd,
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var (
	GoPath = os.Getenv("GOPATH")
	GoSrc  = path.Join(GoPath, "src")

	GotCmd = &cobra.Command{
		Use:   "got",
		Short: "Ebuchmans got tool",
	}
	RepCmd = &cobra.Command{
		Use:   "rep [oldStr] [newStr]",
		Short: "String replace on all files in the directory tree",
		Args:  cobra.ExactArgs(2),
		RunE:  repCmd,
	}
	PullCmd = &cobra.Command{
		Use:   "pull [oldStr] [newStr]",
		Short: "Swap paths, pull changes, swap back",
		Args:  cobra.ExactArgs(2),
		RunE:  pullCmd,
	}
	BranchCmd = &cobra.Command{
		Use:   "branch",
		Short: "List the branch every directory is on",
		RunE:  branchCmd,
	}
	CheckoutCmd = &cobra.Command{
		Use:   "checkout",
		Short: "Checkout a git branch across all repos in the current dir. Add arguments like <repo>:<branch> to specify excpetions and <repo> to specify which repos to run checkout in, if not all.",
		RunE:  checkoutCmd,
	}
	DepCmd = &cobra.Command{
		Use:   "dep",
		Short: "Toggle the import statement for a godep managed dependency",
		RunE:  depCmd,
	}
)

nolint

View Source
var (
	PDFCmd = &cobra.Command{
		Use:   "pdf",
		Short: "reorder pdf pages for booklet printing",
	}
	DoublePDFCmd = &cobra.Command{
		Use:   "double [pdf-file]",
		Short: "double all the pages in a pdf file",
		RunE:  doubleCmd,
		Args:  cobra.ExactArgs(1),
	}
	BookPDFCmd = &cobra.Command{
		Use:   "book [pdf-file]",
		Short: "first half on right, last half on left",
		RunE:  bookCmd,
		Args:  cobra.ExactArgs(1),
	}
	AltBookPDFCmd = &cobra.Command{
		Use:   "alt-book [img-files-dir]",
		Short: "first half on right, last half on left",
		Long: `The directory must be an alphanumerically ordered 
image files from the first to last page`,
		RunE: altBookCmd,
		Args: cobra.ExactArgs(1),
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var AddCalEntryCmd = &cobra.Command{
	Use:  "add [source-file] [lineno]",
	Args: cobra.ExactArgs(2),
	RunE: func(cmd *cobra.Command, args []string) error {

		sourceFile := args[0]
		entryLineNo, err := strconv.Atoi(args[1])
		if err != nil {
			return err
		}
		if !common.FileExists(sourceFile) {
			return errors.New("file don't exist")
		}
		lines, err := common.ReadLines(sourceFile)
		if err != nil {
			return err
		}

		name := lines[entryLineNo][15:]
		year := strconv.Itoa(time.Now().Year())
		month, day := "", ""

		for i := entryLineNo; i > 0; i-- {
			line := lines[i]
			if len(line) == 0 {
				return fmt.Errorf("empty line: %v", i)
			}
			monthI := monthNumber(line[0:3])
			dayI := dayNumber(line[4:6])
			if len(month) == 0 && len(monthI) == 2 {
				month = monthI
			}
			if len(day) == 0 && len(dayI) == 2 {
				day = dayI
			}
			if len(month) != 0 && len(day) != 0 {
				break
			}
		}

		date := fmt.Sprintf("%v-%v-%v", year, month, day)

		credentialsFile, err := getFileInThisPath(credentialsFileName)
		if err != nil {
			return err
		}

		b, err := ioutil.ReadFile(credentialsFile)
		if err != nil {
			log.Fatalf("Unable to read client secret file: %v", err)
		}

		config, err := google.ConfigFromJSON(b, calendar.CalendarEventsScope)
		if err != nil {
			log.Fatalf("Unable to parse client secret file to config: %v", err)
		}
		client := getClient(config)

		srv, err := calendar.New(client)
		if err != nil {
			log.Fatalf("Unable to retrieve Calendar client: %v", err)
		}

		event := &calendar.Event{
			Summary:  name,
			Location: "",
			Start: &calendar.EventDateTime{
				Date:     date,
				TimeZone: "America/Toronto",
			},
			End: &calendar.EventDateTime{
				Date:     date,
				TimeZone: "America/Toronto",
			},
		}

		calendarID := "primary"
		event, err = srv.Events.Insert(calendarID, event).Do()
		if err != nil {
			log.Fatalf("Unable to create event. %v\n", err)
		}
		fmt.Printf("Event created: %s\n", event.HtmlLink)

		return nil
	},
}

add an entry to the calendar

View Source
var (
	Bookmark = &cobra.Command{
		Use:   "bm [url] <tag1,tag2,tag3,...>",
		Short: "bookmark the url with the following tags",
		Args:  cobra.RangeArgs(1, 2),
		RunE:  BookmarksCmd,
	}
)

speedy todolists

View Source
var CalCmd = &cobra.Command{
	Use:   "cal",
	Short: "vim calandar managment",
}

root command for calendar commands

View Source
var (
	ColourCmd = &cobra.Command{
		Use:   "colour <filepath-to-image> [run-durations-seconds] [final-mix-volume-ml]",
		Short: "determine subtractive colour mixing, provided image must be completely the desired colour",
		RunE:  mixColourCmd,
		Args:  cobra.MaximumNArgs(3),
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var (
	ConvertCmd = &cobra.Command{
		Use:     "convert [amount] [unit] to [unit] <of> <material>",
		Short:   "convert arbitrary values between units",
		Aliases: []string{"cv", "cvt"},
		Args:    cobra.RangeArgs(4, 6),
		RunE:    convertCmd,
	}
)

file commands

View Source
var CreateAlias = &cobra.Command{
	Use:  "create-alias [dirs...]",
	Args: cobra.MinimumNArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {

		thisPath, err := os.Getwd()
		if err != nil {
			return err
		}
		srcPrefix := path.Join(os.ExpandEnv("$GOPATH"), "src") + "/"
		baseImportDir := strings.TrimPrefix(thisPath, srcPrefix)

		var importDirs, fullDirs []string
		for _, dir := range args {
			importDir := path.Join(baseImportDir, dir)
			importDir = strings.TrimSuffix(importDir, "/")
			importDirs = append(importDirs, importDir)
			fullDirs = append(fullDirs, path.Join(srcPrefix, importDir))
		}

		packageName := path.Base(thisPath)
		aliasFilePath := path.Join(thisPath, "alias.go")
		return CreateAliasFromDirs(packageName, aliasFilePath, importDirs, fullDirs)
	},
}

CreateAlias creates autogen code for exposed functions

View Source
var ErrNotGitRepo = fmt.Errorf("Not a git repo")

ErrNotGitRepo - Error for not a git repo

View Source
var (
	FlipBook = &cobra.Command{
		Use:   "flipbook [book-pages] [repeat] [GIF]",
		Short: "calendar utilities",
		RunE:  FlipBookCmd,
	}
)

speedy todolists

View Source
var (
	GridpaperCmd = &cobra.Command{
		Use:   "grid",
		Short: "print gridpaper",
		RunE:  gridpaperCmd,
	}
)

speedy todolists

View Source
var (
	Habits = &cobra.Command{
		Use:   "habits [YYYY-MM-DD]",
		Short: "print daily activities sheet beginning today (or at the specified date)",
		Args:  cobra.MaximumNArgs(1),
		RunE:  HabitsCmd,
	}
)

speedy todolists

View Source
var HtmlServeCmd = &cobra.Command{
	Use:     "html-serve",
	Aliases: []string{"srv", "serve"},
	Run: func(cmd *cobra.Command, args []string) {
		http.Handle("/", http.FileServer(http.Dir(".")))
		err := http.ListenAndServe(":8080", nil)
		if err != nil {
			log.Fatal("ListenAndServe: ", err)
		}
	},
}

sample

View Source
var (
	ImgWavCmd = &cobra.Command{
		Use:   "imgwav [file] [k-samples] [loops]",
		Short: "generate a wav file from an image",
		Args:  cobra.ExactArgs(3),
		RunE: func(cmd *cobra.Command, args []string) error {

			volumeMul := 1.0
			freqMin := 0.004
			freqMax := 2.3

			samplesArg, err := strconv.Atoi(args[1])
			if err != nil {
				return err
			}
			loopsArg, err := strconv.Atoi(args[2])
			if err != nil {
				return err
			}

			imgFile, err := os.Open(args[0])
			if err != nil {
				return err
			}
			defer imgFile.Close()

			image.RegisterFormat("jpeg", "jpeg", jpeg.Decode, jpeg.DecodeConfig)
			image.RegisterFormat("gif", "gif", gif.Decode, gif.DecodeConfig)
			image.RegisterFormat("png", "png", png.Decode, png.DecodeConfig)

			img, _, err := image.Decode(imgFile)
			if err != nil {
				log.Fatal(err)
			}

			type AF struct {
				ampl float64
				freq float64
			}

			var AFs []AF
			for y := img.Bounds().Min.Y; y < img.Bounds().Max.Y; y++ {
				for x := img.Bounds().Min.X; x < img.Bounds().Max.X; x++ {
					rI, gI, bI, _ := img.At(x, y).RGBA()

					r, g, b := (float64(rI) / 65535), (float64(gI) / 65535), (float64(bI) / 65535)

					max := math.Max(math.Max(r, g), b)
					min := math.Min(math.Min(r, g), b)

					luminosity := (max + min) / 2
					saturation := 0.0
					diff := max - min
					if diff == 0 {
						continue
					}
					if luminosity < 0.5 {
						saturation = diff / (max + min)
					} else {
						saturation = diff / (2 - max - min)
					}
					audioIntensity := saturation * luminosity * volumeMul
					_ = audioIntensity

					hue := 0.0
					r2 := (((max - r) / 6) + (diff / 2)) / diff
					g2 := (((max - g) / 6) + (diff / 2)) / diff
					b2 := (((max - b) / 6) + (diff / 2)) / diff
					switch {
					case r == max:
						hue = b2 - g2
					case g == max:
						hue = (1.0 / 3.0) + r2 - b2
					case b == max:
						hue = (2.0 / 3.0) + g2 - r2
					}
					switch {
					case hue < 0:
						hue += 1
					case hue > 1:
						hue -= 1
					}
					freq := freqMin + hue*(freqMax-freqMin)

					af := AF{
						ampl: audioIntensity,
						freq: freq,
					}
					AFs = append(AFs, af)
				}
			}
			fmt.Println("calculated AFs")

			rootName := strings.Split(path.Base(args[0]), ".")[0]
			fp := fmt.Sprintf("./%v.wav", rootName)
			outfile, err := os.OpenFile(fp, os.O_RDWR|os.O_CREATE, 0600)
			if err != nil {
				return err
			}
			defer func() {
				outfile.Close()
			}()

			timeMultiplier := uint32(loopsArg)
			numSamples := uint32(samplesArg) * 1000
			var numChannels uint16 = 1
			var sampleRate uint32 = 44100
			var bitsPerSample uint16 = 16
			finalSamples := numSamples * timeMultiplier
			writer := wav.NewWriter(outfile, finalSamples, numChannels, sampleRate, bitsPerSample)
			samples := make([]wav.Sample, finalSamples)

			ssamples := make([]int, numSamples)

			for i := 0; i < int(numSamples); i++ {
				if int(numSamples/10) != 0 && i%int(numSamples/10) == 0 {
					per := int(100 * (float64(i) / float64(numSamples)))
					fmt.Printf("sampling %v percent\n", per)
				}
				sum := 0.0
				for _, af := range AFs {
					sum += af.ampl * math.Sin(af.freq*float64(i))
				}
				ssamples[i] = int(int16(sum))
			}

			ii := 0
			for n := 0; n < int(timeMultiplier); n++ {
				if int(timeMultiplier/10) != 0 && n%int(timeMultiplier/10) == 0 {
					per := int(100 * (float64(n) / float64(timeMultiplier)))
					fmt.Printf("writting %v percent\n", per)
				}
				for i := 0; i < int(numSamples); i++ {
					samples[ii].Values[0] = int(int16(ssamples[i]))
					ii++
				}
			}

			fmt.Printf("saving audio...\n")
			err = writer.WriteSamples(samples)
			if err != nil {
				return err
			}

			outfile.Close()
			return nil
		},
	}
)

file commands intensity == saturation*Luminosity

physically speaking, we should probably turn
the remaining grey (1-saturation)*Luminosity
into white noise... but lets not right now

hue == frequency

View Source
var (
	MasonLabels = &cobra.Command{
		Use:   "masonjar <common> <label1,#ofLabel1;label2,#ofLabel2;etc>",
		Short: "print 24 labels for mason jars",
		Args:  cobra.RangeArgs(1, 2),
		RunE:  MasonLabelsCmd,
	}
)

speedy todolists

View Source
var (
	MathWavCmd = &cobra.Command{
		Use:   "mathwav",
		Short: "generate a wav file",
		Args:  cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			outfile, err := os.OpenFile("./mathaudio.wav", os.O_RDWR|os.O_CREATE, 0600)
			if err != nil {
				return err
			}

			defer func() {
				outfile.Close()
			}()

			var numSamples uint32 = 100000
			var numChannels uint16 = 1
			var sampleRate uint32 = 44100
			var bitsPerSample uint16 = 16

			writer := wav.NewWriter(outfile, numSamples, numChannels, sampleRate, bitsPerSample)
			samples := make([]wav.Sample, numSamples)

			amplitude := 300.0
			for i := 0; i < int(numSamples); i++ {

				freq1 := 2.3
				y1 := amplitude * math.Sin(freq1*float64(i))
				y2 := amplitude * math.Cos(freq1*float64(i)/2) * math.Cos(freq1*float64(i))

				y3 := amplitude*math.Sin(freq1*float64(i)) + amplitude*freq1*math.Sin(float64(i)/freq1)

				_ = y1
				_ = y2
				_ = y3

				samples[i].Values[0] = int(int16(y1))
			}

			err = writer.WriteSamples(samples)
			if err != nil {
				return err
			}

			outfile.Close()
			return nil
		},
	}
)

file commands

View Source
var (
	PWGenCmd = &cobra.Command{
		Use:   "pw [length] [chset]",
		Short: "pw generator; chset can be \"simple\", or \"adv\"",
		RunE:  pwGenCmd,
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var (
	PaperCalCmd = &cobra.Command{
		Use:   "paper-cal [year]",
		Short: "make a paper calendar for your year",
		Args:  cobra.ExactArgs(1),
		RunE:  paperCalCmd,
	}
)

Lock2yamlCmd represents the lock2yaml command

View Source
var PrintTodoCmd = &cobra.Command{
	Use: "print-todo",
	RunE: func(cmd *cobra.Command, args []string) error {
		items, found := wb.GetWB("paper-todo")
		if !found {
			return errors.New("can't find wb paper-todo")
		}
		pdf := gofpdf.New("P", "mm", "Letter", "")
		pdf.AddPage()
		pdf.SetFont("courier", "", 12)

		for i, item := range items {
			bullet := " - " + item
			pdf.Text(3, float64(20+5*i), bullet)
			pdf.Text(105, float64(20+5*i), bullet)
			pdf.Text(3, float64(155+5*i), bullet)
			pdf.Text(105, float64(155+5*i), bullet)
		}

		err := pdf.OutputFileAndClose("temp.pdf")
		if err != nil {
			return err
		}

		command1 := fmt.Sprintf("lp temp.pdf")
		output1, err := common.Execute(command1)
		fmt.Printf("%v\n%v\n", command1, output1)
		if err != nil {
			return err
		}

		return os.Remove("temp.pdf")
	},
}

speedy todolists

View Source
var RemoveCalEntryCmd = &cobra.Command{
	Use: "remove [source-file] [lineno]",
	Run: func(cmd *cobra.Command, args []string) {

	},
}

remove an entry to the calendar

View Source
var RootCmd = &cobra.Command{
	Use:   "mt [expr]",
	Short: "multitool, a collection of handy lil tools",
	Args:  cobra.ArbitraryArgs,
	RunE: func(cmd *cobra.Command, args []string) error {

		// First attempt to calculate like math
		var mathErr error
		argsJoined := strings.Join(args, "")
		amountExpr, err := govaluate.NewEvaluableExpression(argsJoined)
		if err != nil {
			mathErr = err
		}
		if mathErr == nil {
			amountI, err := amountExpr.Evaluate(map[string]interface{}{})
			if err != nil {
				mathErr = err
			}
			if mathErr == nil {
				fmt.Println(amountI.(float64))
				return nil
			}
		}

		if len(args) >= 4 && len(args) <= 6 {
			err := convertCmd(nil, args)
			if err == nil {
				return nil
			}
		}

		return errors.New("could not resolve command")
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var SampleCmd = &cobra.Command{
	Use: "sample",
	Run: func(cmd *cobra.Command, args []string) {

		quac.Initialize(os.ExpandEnv("$HOME/.thranch_config"))
		urlsClumped := quac.GetForApp("sample")
		urls := strings.Split(urlsClumped, "\n")

		for _, url := range urls {

			fmt.Printf("sampling' %v - ", url)
			out, err := common.Execute(fmt.Sprintf("scdl -l %v", url))
			if err != nil {
				fmt.Printf("\terr: %v\n", err)
			} else {
				fmt.Printf("\tresult: %v\n", out)
			}
		}
	},
}

sample

View Source
var SlackCmd = &cobra.Command{
	Use:   "slack [names...]",
	Short: "From/to clipboard - slack text, delete extra lines and timestamps",
	RunE: func(cmd *cobra.Command, args []string) error {

		text, err := clipboard.ReadAll()
		if err != nil {
			return err
		}

		re := regexp.MustCompile(`\[(\d|\d\d)\:\d\d(|\s[A-Z]{2})\]`)
		text = re.ReplaceAllString(text, "")

		re = regexp.MustCompile(`(?m)^\s*$[\r\n]*|[\r\n]+\s+\z`)
		text = re.ReplaceAllString(text, "")

		text = strings.Replace(text, "@", "", -1)

		for _, arg := range args {
			text = strings.Replace(text, "\n"+arg+"\n", "\n\n**"+arg+"**\n", -1)
			text = strings.Replace(text, "\n"+arg+" \n", "\n\n**"+arg+"**\n", -1)
			text = strings.Replace(text, "\n"+arg+"  \n", "\n\n**"+arg+"**\n", -1)
		}

		err = clipboard.WriteAll(text)
		if err != nil {
			return err
		}

		fmt.Println("Processed successfully")
		return nil
	},
}

Lock2yamlCmd represents the lock2yaml command

View Source
var (
	TocCmd = &cobra.Command{
		Use:   "toc [optional-folder]",
		Short: "generate a markdown table of contents",
		Args:  cobra.MaximumNArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			dir := "./"
			if len(args) == 1 {
				dir = args[0]
			}
			files, err := ioutil.ReadDir(dir)
			if err != nil {
				return err
			}
			tocNumber := 1
			for _, f := range files {
				if f.IsDir() {
					continue
				}
				name := f.Name()
				if string(name[0]) == "." {
					continue
				}
				if strings.ToLower(name) == "readme.md" {
					continue
				}

				p := path.Join(dir, name)
				if strings.ToLower(path.Ext(p)) != ".md" {
					continue
				}
				mdContents, err := common.ReadLines(p)
				if err != nil {
					return err
				}

				parsed := parseHeaders(mdContents)

				fileTitle := name
				if len(parsed[1]) == 1 {
					fileTitle = parsed[1][0]
				}
				fmt.Printf("%v. **[%v](%v)**\n", tocNumber, fileTitle, p)
				tocNumber++

				for _, subTitle := range parsed[2] {
					linking := strings.ToLower(subTitle)
					linking = strings.Replace(linking, " ", "-", -1)
					fmt.Printf("    - [%v](%v#%v)\n", subTitle, p, linking)
				}
			}
			return nil
		},
	}
)

file commands

View Source
var UpdateAlias = &cobra.Command{
	Use:  "update-alias [alias-file-dir]",
	Args: cobra.ExactArgs(1),
	RunE: func(cmd *cobra.Command, args []string) error {

		lines, err := common.ReadLines(args[0])
		if err != nil {
			return err
		}

		srcPrefix := path.Join(os.ExpandEnv("$GOPATH"), "src") + "/"

		var importDirs, fullDirs []string
		for _, line := range lines {
			if strings.Contains(line, AliasKeyword) {
				importDir := strings.TrimSpace(strings.Split(line, AliasKeyword)[1])
				importDirs = append(importDirs, importDir)
				fullDir := path.Join(srcPrefix, importDir)
				fullDirs = append(fullDirs, fullDir)
			}
		}

		aliasFilePath := args[0]
		if !common.FileExists(aliasFilePath) {
			thisPath, err := os.Getwd()
			if err != nil {
				return err
			}

			aliasFilePath = path.Join(thisPath, args[0])
		}
		packageName := path.Base(path.Dir(aliasFilePath))
		return CreateAliasFromDirs(packageName, aliasFilePath, importDirs, fullDirs)
	},
}

CreateAlias creates autogen code for exposed functions

Functions

func AccumulateRandResults

func AccumulateRandResults(randSource int64, runDur time.Duration, inputs []colour.FRGB, goal colour.FRGB) (fits map[float64]colour.InputProportions)

Get a bunch of random results

func AddPageCutMarks

func AddPageCutMarks(pdf *gofpdf.Fpdf)

write cut marks

func AddPageCutMarks2

func AddPageCutMarks2(pdf *gofpdf.Fpdf)

write cut marks

func BookmarksCmd

func BookmarksCmd(cmd *cobra.Command, args []string) error

TODO auto search website for keywords display these keywords before commiting them in here, user must approve

func CompileOutput

func CompileOutput(packageName string, pas []PackageAlias) string

compile package aliases into output string

func CreateAliasFromDirs

func CreateAliasFromDirs(packageName, aliasFilePath string, importDirs, fullDirs []string) error

CreateAliasFromDirs

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func FlipBookCmd

func FlipBookCmd(cmd *cobra.Command, args []string) error

func GetDayForFirstWeekday

func GetDayForFirstWeekday(
	monthsDate time.Time, wd time.Weekday) (dayNumber int)

func GetDayForLastWeekday

func GetDayForLastWeekday(
	monthsDate time.Time, wd time.Weekday) (dayNumber int)

func GetDayForNthWeekday

func GetDayForNthWeekday(
	year int, month time.Month, wd time.Weekday, occurance int) (dayNumber int)

occurance = 1 for the first occurance for occurance 1 of each weekday this function will return the prev month's dayNumber for each weekday before the weekday which is the first day of the provided month

func HabitsCmd

func HabitsCmd(cmd *cobra.Command, args []string) error

func MasonLabelsCmd

func MasonLabelsCmd(cmd *cobra.Command, args []string) error

func RipDaysCmd

func RipDaysCmd(cmd *cobra.Command, args []string) error

func SplitAnimatedGIF

func SplitAnimatedGIF(reader io.Reader, writePath string) (imgWidth, imgHeight int, err error)

Decode reads and analyzes the given reader as a GIF image

Types

type PackageAlias

type PackageAlias struct {
	Dir        string
	Name       string
	FuncNames  []string
	VarNames   []string
	ConstNames []string
	TypeNames  []string
}

FileAliases - file alaises

func CreatePackageAlias

func CreatePackageAlias(importDir, fullDir string, files []os.FileInfo) (PackageAlias, error)

NewfileAliases creates a new fileAliases object

Jump to

Keyboard shortcuts

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