2024-01-26 19:32:21 -06:00
/ *
Copyright © 2024 Dan Jones < danjones @ goodevilgenius . org >
This program is free software : you can redistribute it and / or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation , either version 3 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU Affero General Public License for more details .
You should have received a copy of the GNU Affero General Public License
along with this program . If not , see < http : //www.gnu.org/licenses/>.
* /
2026-02-28 16:45:57 -06:00
package cli
2024-01-26 19:32:21 -06:00
import (
"os"
2024-02-04 18:19:19 -06:00
"codeberg.org/danjones000/my-log/config"
2024-01-26 19:32:21 -06:00
"github.com/spf13/cobra"
)
2026-02-28 16:45:57 -06:00
var RootCmd = & cobra . Command {
2024-01-26 19:32:21 -06:00
Use : "my-log" ,
Short : "A brief description of your application" ,
}
func Execute ( ) {
2026-02-28 16:45:57 -06:00
err := RootCmd . Execute ( )
2024-01-26 19:32:21 -06:00
if err != nil {
os . Exit ( 1 )
}
}
func init ( ) {
2026-02-28 16:45:57 -06:00
RootCmd . PersistentFlags ( ) . StringVarP ( & config . ConfigPath , "config" , "c" , config . ConfigPath , "config file" )
RootCmd . PersistentFlags ( ) . StringToStringVarP ( & config . Overrides , "config-value" , "v" , config . Overrides , "Override config values. Use dot syntax to specify key. E.g. -v output.stdout.config.format=json" )
2024-01-26 19:32:21 -06:00
}