Documentation
¶
Overview ¶
Modules can register custom hooks here that will plug into urfave *cli.App API. The hooks will be called in the same order as defined urfave's cli.
Index ¶
Constants ¶
View Source
const (
PocketImporterID = "pocket-import"
)
Variables ¶
View Source
var ConfigCmds = &cli.Command{ Name: "config", Commands: []*cli.Command{ cfgPrintCmd, cfgDebugCmd, }, }
View Source
var DebugInfoCmd = &cli.Command{ Name: "debug-info", Hidden: true, Action: func(_ context.Context, _ *cli.Command) error { build.DebugInfo() return nil }, }
View Source
var DetectCmd = &cli.Command{ Name: "detect", Aliases: []string{"det"}, Usage: "detect installed browsers", Action: func(ctx context.Context, cmd *cli.Command) error { red := color.New(color.FgRed).SprintFunc() green := color.New(color.FgGreen).SprintFunc() mods := modules.GetModules() fmt.Printf("\n detected browsers:\n\n") for _, mod := range mods { browser, isBrowser := mod.ModInfo().New().(modules.BrowserModule) if !isBrowser { log.Debugf("module <%s> is not a browser", mod.ModInfo().ID) continue } pm, isProf := browser.(profiles.ProfileManager) if !isProf { log.Debugf("module <%s> is not a profile manager", mod.ModInfo().ID) d, ok := browser.(modules.Detector) if ok { detected, err := d.Detect() if err != nil { return fmt.Errorf("detecting browser: %w", err) } for _, dbr := range detected { fmt.Printf(" %s %-10s \t %s\n", green(""), dbr.Flavour, dbr.BasePath) } } else { fmt.Printf(" %s %-10s\n", red(""), mod.ModInfo().ID) } continue } flavours := pm.ListFlavours() for _, f := range flavours { log.Debugf("considering flavour <%s> of <%s>", f.Flavour, mod.ModInfo().ID) if dir, err := f.ExpandBaseDir(); err != nil { log.Info("base directory not found", "path", f.BaseDir(), "flavour", f.Flavour) continue } else { fmt.Printf(" %s %-10s \t %s\n", green(""), f.Flavour, dir) } } } fmt.Println() return nil }, }
View Source
var ExportCmds = &cli.Command{ Name: "export", Usage: "One-time export to other formats", Description: `The export command provides functionality to export bookmarks to other browser or application formats. `, Commands: []*cli.Command{ exportNSHTMLCmd, exportPocketHTMLCmd, exportJSONCmd, exportRSSCmd, }, }
View Source
var ImportCmds = &cli.Command{ Name: "import", Usage: "one-time import from other programs", Description: `The import command provides subcommands to migrate bookmarks from various sources. Use the specific import subcommands to perform migrations.`, Commands: []*cli.Command{ importBukuDBCmd, importPocketCmd, }, }
View Source
var MainFlags = []cli.Flag{ logging.DebugFlag, &cli.StringFlag{ Name: "config", Aliases: []string{"c"}, Value: config.DefaultConfPath(), Usage: "config `path`", DefaultText: utils.Shorten(config.DefaultConfPath()), Destination: &config.ConfigFileFlag, }, &cli.StringFlag{ Name: "db", Value: database.GetDBPath(), DefaultText: utils.Shorten(database.GetDBPath()), Usage: "`path` where gosuki.db is stored", Destination: &config.DBPath, Sources: cli.NewValueSourceChain(toml.TOML("database.path", altsrc.NewStringPtrSourcer(&config.ConfigFileFlag))), }, }
Functions ¶
func GlobalFlags ¶
GlobalFlags returns the registered global flags for a given registered module
func RegBeforeHook ¶
Register a module hook to be run in *cli.App.Before
func RegGlobalModFlag ¶
RegGlobalModFlag registers global flags to pass on to the browser module
func RegisterModCommand ¶
func RegisteredModCommands ¶
func RegisteredModCommands(modID string) modCmds
return list of registered commands for browser module
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.