canvas

package
v0.0.0-...-ecfc617 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CatCmd = &cobra.Command{
	Use:   "cat",
	Short: "simple cat program for canvas (wip)",
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) > 0 {
			canvasFilePath = args[0]
		}

		r, err := canvas_tools.NewRepo(canvasFilePath)
		if err != nil {
			return fmt.Errorf("can't open repo: %w", err)
		}

		c, err := r.One()
		if err != nil {
			return fmt.Errorf("can't get one canvas: %w", err)
		}

		spew.Dump(c)
		return nil
	},
}
View Source
var Cmd = &cobra.Command{
	Use:   "canvas",
	Short: "canvas utils",
	Run: func(cmd *cobra.Command, args []string) {
		_ = cmd.Help()
	},
}
View Source
var StatCmd = &cobra.Command{
	Use:   "stat",
	Short: "show some canvas stats",
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) > 0 {
			canvasFilePath = args[0]
		}

		r, err := canvas_tools.NewRepo(canvasFilePath)
		if err != nil {
			return fmt.Errorf("can't open repo: %w", err)
		}

		c, err := r.One()
		if err != nil {
			return fmt.Errorf("can't get one canvas: %w", err)
		}

		fmt.Printf("Canvas: %s\n", filepath.Base(canvasFilePath))

		fmt.Printf("\tNodes: %d\n", len(c.Nodes))
		fmt.Print(nodeDetails(c))

		fmt.Printf("\tEdges: %d\n", len(c.Edges))

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL