(ctx *snap.Context)
| 1645 | } |
| 1646 | |
| 1647 | func runOpenDoc(ctx *snap.Context) error { |
| 1648 | if ctx.NArgs() != 1 { |
| 1649 | fmt.Fprintf(ctx.Stderr(), "Usage: %s openDoc <doc-type>\n", commandName) |
| 1650 | fmt.Fprintf(ctx.Stderr(), "Available doc types: %s\n", strings.Join(availableDocKeys(), ", ")) |
| 1651 | return fmt.Errorf("expected 1 argument, got %d", ctx.NArgs()) |
| 1652 | } |
| 1653 | |
| 1654 | docType := ctx.Arg(0) |
| 1655 | docType = strings.TrimSpace(docType) |
| 1656 | spec, ok := resolveDocSpec(docType) |
| 1657 | if !ok { |
| 1658 | fmt.Fprintf(ctx.Stderr(), "Unknown doc type %q. Available: %s\n", docType, strings.Join(availableDocKeys(), ", ")) |
| 1659 | return fmt.Errorf("unknown doc type %q", docType) |
| 1660 | } |
| 1661 | |
| 1662 | return openDoc(ctx, spec) |
| 1663 | } |
| 1664 | |
| 1665 | func runOpenChanges(ctx *snap.Context) error { |
| 1666 | if ctx.NArgs() != 0 { |
no test coverage detected