diff options
author | F.O. <scrotadamus@insiberia.net> | 2025-02-16 17:56:08 +0100 |
---|---|---|
committer | F.O. <scrotadamus@insiberia.net> | 2025-02-16 17:56:57 +0100 |
commit | 17fb6add26291b31f7020e3551a7c8487130a747 (patch) | |
tree | d4559a7339ed181393ff921909e6ce05b7c2cf18 /cmd/tag/tag.go |
genesi
Diffstat (limited to 'cmd/tag/tag.go')
-rw-r--r-- | cmd/tag/tag.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/cmd/tag/tag.go b/cmd/tag/tag.go new file mode 100644 index 0000000..30e41c8 --- /dev/null +++ b/cmd/tag/tag.go @@ -0,0 +1,63 @@ +/* +Copyright © 2025 NAME HERE <EMAIL ADDRESS> + +*/ +package tag + +import ( + "regexp" + "github.com/spf13/cobra" +) + + +var tags []string + +var regex, exact string + +func formatRegex(r string, boundaries string) string { + //return `\b` + r + `\b` + return boundaries + r + boundaries +} + +func regexSlice(regex string, slice []string) []string { + if regex == "" { + return slice + } + + var newSlice []string + re, err := regexp.Compile(regex) + if err != nil { + panic(err) + } + for _, s := range(slice){ + if re.MatchString(s){ + newSlice = append(newSlice, s) + } + } + + return newSlice +} + +// tagCmd represents the tag command +var TagCmd = &cobra.Command{ + Use: "tag", + Short: "manage pdf tags", + Long: `a tag is a string you can attach to a pdf +.`, +} + +func init() { + //rootCmd.AddCommand(tagCmd) + + // Here you will define your flags and configuration settings. + + // Cobra supports Persistent Flags which will work for this command + // and all subcommands, e.g.: + // tagCmd.PersistentFlags().String("foo", "", "A help for foo") + + // Cobra supports local flags which will only run when this command + // is called directly, e.g.: + // tagCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") + // TODO add to "add" command + // tagCmd.Flags().StringArrayVarP(&tags, "tag", "t", []string{}, "Tag da associare ai file (può essere usato più volte)") +} |