Coder Social home page Coder Social logo

rwxrob / bonzai Goto Github PK

View Code? Open in Web Editor NEW
151.0 7.0 16.0 516 KB

🌳 Go Bonzai™ Composite Commander, meticulously manicured monolith and multicall binaries, built from imported composite commands, on any device, with recursive, light-weight tab completion, and colorful embedded documentation from terminal or local web browser. Replace messy collections of shell scripts ported to clean Go.

License: Apache License 2.0

Go 100.00%
cli commander cobra help documentation golang terminal composition busybox bonzai

bonzai's Introduction

bonzai's People

Contributors

pandoxer avatar rwxrob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

bonzai's Issues

Add main alias shell escaping

When tab completion happens the ! characters and such need to be
escaped. But this will depend on the shell environment, but since
COMP_LINE will never be set for anything but bash we are good to assume
it.

Add `cmd.Shell`

The cmd.Shell should create a rich-terminal interactive shell that
contains help information and a prompt with tab completion. This will
ease the pain of using Bonzai commands where complete -C foo foo
support is not enabled (including inferior shells like zsh, fish,
powershell).

Refactor Expect completely into methods (no recursion)

At long last I've seen the light. It was always grating on me that
Expected used so much unnecessary functional recursion. Using simple
scanner methods that panic is easier to write and maintain, faster,
cleaner, and just as easy to generate from PEGN. I'll still keep the
one-to-one parity with PEGN and read a comment to associate a given
method with a specific ID from PEGN. First I'll factor into methods,
then I'll write the method generator, then we'll write the reverse to
PEGN generator.

Change default import name to Z

Since Bonzai's focus is on rapid development and clean code I'm making
the default import package name Z (instead of bonzai). The likelihood
of people having package naming conflicts with a capital Z is very
unlikely and anything that does can set the prefix to something else.
Basically, I want the default to be as easy to use as possible. Go
formalists will scream at me for this, but I don't give a fuck.

Add 1.18 fuzzy tests to Parse tests

Need to setup re-creatable fuzzers for anything that has a set of any
kind. For example, is.WS has quite a few different combinations.
Something like scan.Expect(is.Opt{is.WS},"foo",is.Opt{is.WS}) has
several hundred possible combinations.

Add standard compiled util testing

Go has no standardized way to test the compiled commands (focusing
instead on functions and methods). While this is fine for most
applications development, Bonzai developers have a consistent need to
test every possible command line invocation or their final commands
(post compilation). The usual tricks to get os.Args[0] and run that
seem clunky and inconsistent. Something more is needed.

The need for a custom solution is increased when considering that
examples of command line usage are a fundamental part of the
documentation and regularly are buggy in the docs. So any test solution
must incorporate the ability to embed the runnable tests into the
compiled binary so that they are available with foo help examples.

In fact, why not give them unique names and allow the examples to be run
from the command line by adding run after the name (foo help example bar run).

We need a bonzai.mark parser and AST handler

Since documentation is a core value proposition from Bonzai, we need to
really create a formal specification (PEGN), parser, and AST for the
unique (but compatible) bonzai.mark language. Creating an AST is
essential for Cmd creators who want to create views of the documentation
in other formats besides text, such as from a local web server.

Change maps package to only contain map functions

We want to reserve the maps subpackage for nothing but map functions so
people can peruse it for map functions they might need and not want to
rewrite. This also gives a good overview of how to use map functions.
Anything that is not a map function should find another home.

Prevent repeating final completions

After reaching the leaf completion continually tapping tab keeps adding
the last completion leaf item to the end of the command line. We need to
trap this from happening.

Add embedded help examples generated from example tests

Examples are the most important part of the documentation and they
already have to be created as unit tests anyway. So we need to create a
generator directive that grabs them from the examples_test.go files
when the command is compiled and embedded. In fact, we can simple embed
the examples_test.go file itself and add the code to cmd.Help to
open it and parse the essential parts of it and transform it exactly as
the unit test reflection method uses.

Add Cmd.AutoUpdate

Should look at Version detect an VERSION file within the Source URL
location making intelligent decisions about the Source URL expansion
required by the hosting service (github.com, for example). If not
VERSION file is found and the service is github.com use the GitHub API
to determine the latest release. It is important that there be no
dependency on Git for checking for a latest version allowing
distribution of binaries to take place on a simple web server with a
VERSION file next to the binaries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.