45 lines
917 B
Go
45 lines
917 B
Go
/*
|
|
* Copyright 2026 Oleg Borodin <onborodin@gmail.com>
|
|
*
|
|
* This work is published and licensed under a Creative Commons
|
|
* Attribution-NonCommercial-NoDerivatives 4.0 International License.
|
|
*
|
|
* Distribution of this work is permitted, but commercial use and
|
|
* modifications are strictly prohibited.
|
|
*/
|
|
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"helmet/cmd/minilbadm/hash"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type Tool struct {
|
|
cmd *cobra.Command
|
|
hashTool *hash.Tool
|
|
}
|
|
|
|
func NewTool() *Tool {
|
|
execName := filepath.Base(os.Args[0])
|
|
tool := &Tool{}
|
|
tool.cmd = &cobra.Command{
|
|
Use: execName,
|
|
Short: "\nHash tool",
|
|
SilenceUsage: true,
|
|
}
|
|
tool.cmd.CompletionOptions.DisableDefaultCmd = true
|
|
|
|
tool.hashTool = hash.NewTool()
|
|
tool.cmd.AddCommand(tool.hashTool.GetCmd())
|
|
return tool
|
|
}
|
|
|
|
func (tool *Tool) Exec(args []string) error {
|
|
tool.cmd.SetArgs(args)
|
|
return tool.cmd.Execute()
|
|
}
|