Files
nib-v1/cmd/root.go
T
lerko 03094706c3 fix: batch tag queries, inline edit, delete response, SPA catch-all, link glyph
- Fix N+1 tag query in List() with batched IN clause
- Add inline body editing in web detail pane (dblclick or e key)
- Delete API returns {result: "soft"|"hard"} with 200 instead of 204
- SPA handler serves index.html for all extensionless paths
- Link glyph changed from emoji 🔗 to unicode ↗ for terminal alignment
- Capture bar contrast and hover glow increased
- Comment on load-bearing "--" in root.go
2026-05-14 12:37:13 -04:00

54 lines
1.0 KiB
Go

package cmd
import (
"os"
"strings"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "nib",
Short: "capture and crystallize notes, todos, and events",
Args: cobra.ArbitraryArgs,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return cmd.Help()
}
return runAdd(cmd, args)
},
SilenceUsage: true,
}
func Execute() error {
if len(os.Args) > 1 {
first := os.Args[1]
isFlag := strings.HasPrefix(first, "-") && !strings.Contains(first, " ")
if first != "help" && first != "completion" &&
!isFlag && !isSubcommand(first) {
// "--" stops cobra from parsing glyph prefixes like "-" as flags
rootCmd.SetArgs(append([]string{"add", "--"}, os.Args[1:]...))
}
}
return rootCmd.Execute()
}
func isSubcommand(name string) bool {
for _, c := range rootCmd.Commands() {
if c.Name() == name {
return true
}
for _, alias := range c.Aliases {
if alias == name {
return true
}
}
}
return false
}
func init() {
rootCmd.AddCommand(addCmd)
rootCmd.AddCommand(lsCmd)
}