Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WikiNodeCreate = common.Shortcut{ Service: "wiki", Command: "+node-create", Description: "Create a wiki node with automatic space resolution", Risk: "write", Scopes: []string{"wiki:node:create", "wiki:node:read", "wiki:space:read"}, AuthTypes: []string{"user", "bot"}, Flags: []common.Flag{ {Name: "space-id", Desc: "target wiki space ID; use my_library for the personal document library"}, {Name: "parent-node-token", Desc: "parent wiki node token; if set, the new node is created under that parent"}, {Name: "title", Desc: "node title"}, {Name: "node-type", Default: wikiNodeTypeOrigin, Desc: "node type", Enum: []string{wikiNodeTypeOrigin, wikiNodeTypeShortcut}}, {Name: "obj-type", Default: "docx", Desc: "target object type", Enum: wikiObjectTypes}, {Name: "origin-node-token", Desc: "source node token when --node-type=shortcut"}, }, Tips: []string{ "If --space-id and --parent-node-token are both omitted, user identity falls back to my_library.", "Use --node-type shortcut --origin-node-token <token> to create a shortcut node.", }, Validate: func(ctx context.Context, runtime *common.RuntimeContext) error { return validateWikiNodeCreateSpec(readWikiNodeCreateSpec(runtime), runtime.As()) }, DryRun: func(ctx context.Context, runtime *common.RuntimeContext) *common.DryRunAPI { return buildWikiNodeCreateDryRun(readWikiNodeCreateSpec(runtime)) }, Execute: func(ctx context.Context, runtime *common.RuntimeContext) error { spec := readWikiNodeCreateSpec(runtime) fmt.Fprintf(runtime.IO().ErrOut, "Creating wiki node...\n") execution, err := runWikiNodeCreate(ctx, wikiNodeCreateAPI{runtime: runtime}, runtime.As(), spec) if err != nil { return err } fmt.Fprintf(runtime.IO().ErrOut, "Created wiki node in space %s via %s.\n", execution.ResolvedSpace.SpaceID, execution.ResolvedSpace.ResolvedBy) runtime.Out(wikiNodeCreateOutput(execution), nil) return nil }, }
WikiNodeCreate wraps wiki node creation with shortcut-specific ergonomics: it can infer the target space from the parent node or the caller's personal document library instead of forcing users to pass a numeric space ID first.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.