projectTable

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(ctx *cli.Context, project *projectLib.Project, prompt string) bool

func List

func List(projects []*client.Project, descriptor Descriptor)
Example
package main

import (
	"fmt"

	projectTable "github.com/taubyte/tau-cli/table/project"
	client "github.com/taubyte/tau/clients/http/auth"
)

func main() {
	project := []*client.Project{
		{
			Id:   "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH",
			Name: "someProject1",
		},
		{
			Id:   "QmbUIDhRosp5BaXDASEWSCtpkQCgQCPdRVhnxjiSHfXdC0",
			Name: "someProject2",
		},
	}

	projectTable.List(project, func(project *client.Project) string {
		return fmt.Sprintf("This is a description of `%s` it does cool stuff I promise", project.Name)
	})

}
Output:

┌─────────────────┬──────────────┬──────────────────────────────────────────┐
│ ID              │ NAME         │ DESCRIPTION                              │
├─────────────────┼──────────────┼──────────────────────────────────────────┤
│ QmbAA8...HfXdWH │ someProject1 │ This is a description of `someProject1`  │
│                 │              │ it does cool stuff I promise             │
├─────────────────┼──────────────┼──────────────────────────────────────────┤
│ QmbUID...HfXdC0 │ someProject2 │ This is a description of `someProject2`  │
│                 │              │ it does cool stuff I promise             │
└─────────────────┴──────────────┴──────────────────────────────────────────┘

func ListNoRender

func ListNoRender(projects []*client.Project, descriptor Descriptor) table.Writer

func Query

func Query(project *client.Project, repos *client.RawRepoDataOuter, description string)
Example
package main

import (
	projectTable "github.com/taubyte/tau-cli/table/project"
	client "github.com/taubyte/tau/clients/http/auth"
)

func main() {
	project := &client.Project{
		Id:   "QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH",
		Name: "someProject",
	}

	repoData := &client.RawRepoDataOuter{
		Configuration: client.RawRepoData{
			Fullname: "taubyte-test/tb_test_project",
			Url:      "https://api.github.com/repos/taubyte-test/tb_test_project",
		},
		Code: client.RawRepoData{
			Fullname: "taubyte-test/tb_code_test_project",
			Url:      "https://api.github.com/repos/taubyte-test/tb_code_test_project",
		},
		Provider: "github",
	}

	projectTable.Query(project, repoData, "some")

}
Output:

┌─────────────┬──────────────────────────────────────────────────────┐
│ ID          │ QmbAA8hRosp5BaXFXikADCtpkQCgQCPdRVhnxjiSHfXdWH       │
├─────────────┼──────────────────────────────────────────────────────┤
│ Name        │ someProject                                          │
├─────────────┼──────────────────────────────────────────────────────┤
│ Description │ some                                                 │
├─────────────┼──────────────────────────────────────────────────────┤
│             │ Code                                                 │
│ Name:       │ taubyte-test/tb_code_test_project                    │
│ URL:        │ https://github.com/taubyte-test/tb_code_test_project │
├─────────────┼──────────────────────────────────────────────────────┤
│             │ Config                                               │
│ Name:       │ taubyte-test/tb_test_project                         │
│ URL:        │ https://github.com/taubyte-test/tb_test_project      │
└─────────────┴──────────────────────────────────────────────────────┘

Types

type Descriptor

type Descriptor func(project *client.Project) string

Takes a project and returns a description

Jump to

Keyboard shortcuts

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