keg_search

package module
v0.0.0-...-81c178f Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

🌳 Go Bonzai™ Composite Command Tree

Create a new GitHub project using this template and change this README.md to match your project. Make all your template changes before making your first commit.

GoDoc License

Install

This command can be installed as a standalone program or composed into a Bonzai command tree.

Standalone

go install github.com/rwxrob/bonzai-example/cmd/bonzai-example@latest

Composed

package z

import (
	Z "github.com/rwxrob/bonzai/z"
	example "github.com/rwxrob/bonzai-example"
)

var Cmd = &Z.Cmd{
	Name:     `z`,
	Commands: []*Z.Cmd{help.Cmd, example.Cmd, example.BazCmd},
}

Tab Completion

To activate bash completion just use the complete -C option from your .bashrc or command line. There is no messy sourcing required. All the completion is done by the program itself.

complete -C bonzai-example bonzai-example

If you don't have bash or tab completion check use the shortcut commands instead.

Embedded Documentation

All documentation (like manual pages) has been embedded into the source code of the application. See the source or run the program with help to access it.

Reminders

  • Change bonzai-example every place to your project name (git grep bonzai-example)
  • Remove anything you don't need
  • Change .github/FUNDING.yaml to your own information
  • Update .gitignore to your liking
  • Will need to go get -u to update dependencies

Other Examples

Documentation

Overview

Package example provides the Bonzai command branch of the same name.

Index

Constants

This section is empty.

Variables

View Source
var BarCmd = &Z.Cmd{
	Name: `bar`,

	Aliases: []string{"B", "notbar"},

	Commands: []*Z.Cmd{help.Cmd, fileCmd},

	Call: func(_ *Z.Cmd, _ ...string) error {
		log.Printf("would bar stuff")
		return nil
	},
}

exported branch

View Source
var Cmd = &Z.Cmd{
	Name:      `search`,
	Summary:   `An experimental search enginer for a keg`,
	Version:   `v0.0.1`,
	Copyright: `Copyright 2023 Jared L Rickert`,
	License:   `Apache-2.0`,
	Site:      `jlrickert.me`,
	Source:    `git@github.com:jlrickert/keg-search.git`,
	Issues:    `github.com/jlrickert/keg-search/issues`,

	Commands: []*Z.Cmd{

		help.Cmd, conf.Cmd, vars.Cmd,

		SearchCmd,
	},

	Dynamic: template.FuncMap{
		"uname": func(_ *Z.Cmd) string { return Z.Out("uname", "-a") },
		"dir":   func() string { return Z.Out("dir") },
	},

	Description: `
		{{aka}} search command documenation
		`,

	Other: []Z.Section{
		{`Custom Sections`, `
			Additional sections can be added to the Other field.

			A Z.Section is just a Title and Body and can be assigned using
			composite notation (without the key names) for cleaner, in-code
			documentation.

			The Title will be capitalized for terminal output if using the
			common help.Cmd, but should use a suitable case for appearing in
			a book for other output renderers later (HTML, PDF, etc.)`,
		},
	},
}

Cmd provides a Bonzai branch command that can be composed into Bonzai trees or used as a standalone with light wrapper (see cmd/).

View Source
var SearchCmd = &Z.Cmd{
	Name:    `search`,
	Aliases: []string{"s"},
	MinArgs: 1,
	Call: func(caller *Z.Cmd, args ...string) error {
		Search(args...)
		return nil
	},
}

Functions

func Search(args ...string)

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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