cmd

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 14 Imported by: 0

README

cmd

  • contants.go: static strings, such as pgmVersion
  • search.go: the search verb
  • insert.go: the insert verb
  • root.go: created by Cobra; contains cmd-line arg definitions
  • dtlib.go: a group of functions related to time
  • helper.go: small functions that perform miscellaneous tasks; strings, maps, etc.

Documentation

Overview

Copyright © 2021 John Taylor

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeheadSlice added in v0.4.0

func BeheadSlice(s []goment.Goment, rm int) []goment.Goment

BeheadSlice - remove items from the beginning of a slice

func ConvertDate added in v0.3.0

func ConvertDate(t time.Time, layoutAny string) string

ConvertDate - convert a date to a different layout

func DisplayStats added in v0.7.0

func DisplayStats(statsData [][]string)

func DisplayTable added in v0.4.0

func DisplayTable(g []goment.Goment, desc string, pause bool, highlight int)

func ExcludeDates added in v0.4.0

func ExcludeDates(reqDate []goment.Goment) []goment.Goment

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 FindInSlice added in v0.4.0

func FindInSlice(s []goment.Goment, item goment.Goment) int

FindInSlice - return the position of item in a slice, or -1 if not found

func GetDuration added in v0.3.0

func GetDuration(a int, period string) time.Duration

GetDuration - convert from allRootOptions.Amount, allRootOptions.Period to a time.Duration

func GetDurationInSeconds added in v0.3.0

func GetDurationInSeconds(a int, period string) int

GetDurationInSeconds - convert from allRootOptions.Amount, allRootOptions.Period to seconds

func GetKeyVal added in v0.3.0

func GetKeyVal(combined string) (int, string)

GetKeyVal - split a string of "N,S" into a number and a string 1,-1 => 1 (int); "-1" (string)

func GetPaddingRange added in v0.4.0

func GetPaddingRange(g goment.Goment) (goment.Goment, goment.Goment)

func GetTimeDifference added in v0.3.0

func GetTimeDifference(a, b goment.Goment) time.Duration

GetTimeDifference - return the difference between to Goment objects

func IsNear added in v0.4.0

func IsNear(csv goment.Goment, reqDate []goment.Goment) (bool, int)

func LimitToSeconds added in v0.7.0

func LimitToSeconds(d durafmt.Durafmt) string

func RemoveSliceItem added in v0.4.0

func RemoveSliceItem(s []goment.Goment, rm int) []goment.Goment

RemoveSliceItem - Remove an item from a slice

func SearchOneFile added in v0.2.2

func SearchOneFile(fname string) ([]goment.Goment, string)

func SortIntMapByKey added in v0.3.0

func SortIntMapByKey(m map[int]string) ([]int, int)

SortIntMapByKey return a slice sorted by key and also return the largest key value

Types

This section is empty.

Jump to

Keyboard shortcuts

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