Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TrimCommand = cli.Command{ Name: "trim", Usage: "remove leading and trailing spaces from page title", ArgsUsage: "<page_id>", Flags: []cli.Flag{ &cli.BoolFlag{ Name: "recursive", Aliases: []string{"r"}, Usage: "process child pages recursively", }, }, Action: func(c *cli.Context) error { if c.NArg() < 1 { return cli.Exit("please provide page id", 1) } n := notion.NewClient(c.String("token")) page, err := n.FindPageByID(context.Background(), c.Args().First()) if err != nil { return cli.Exit(err, 2) } if c.Bool("recursive") { fmt.Fprintf(c.App.Writer, "trimming page titles recursively, any errors will not lead to non-zero exit code\n") for _, err := range trimPageTitlesRecursively(c, n, []notion.Page{page}) { if err != nil { fmt.Fprintf(c.App.ErrWriter, "error trimming page %s: %s\n", page.ID, err) } } } else { if err := trimPageTitle(c, n, page); err != nil { return cli.Exit(err, 2) } } return nil }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.