Git Product home page Git Product logo

appbuilder's People

Contributors

netserf avatar ripienaar avatar robinbowes 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

appbuilder's Issues

Improve help output

Only show top level commands in top level help output

this will require adopting master of kingpin

Support emitting a warning before running a command

Say you will run some command that might need a ^C at the end and its weird, you might want to print a little warning before starting it. So we should support something like prompt but that doesn't wait

Add a appbuilder ui

Needs to be able to list apps, show info about source locations etc and validate apps

RunStandardCLI logging issues

For a custom logger to be used it has to be passed in the log argument AND the WithLogger() option, this is redundant

scaffold missing features

After some experiments scaffold needs a few things:

  • All the template functions in source/target etc and things like AppDir
  • A way to skip empty files
  • A way to customise the delimiters used by template
  • Less annoying logging

Source location in home directory not found on MacOS

I'm taking a first look at appbuilder on a Macbook Pro running Monterey, I installed with Homebrew.

Following the Quick Start, I put the command definition in ~/.config/appbuilder/demo-app.yaml, and symlinked applbuilder to ~/bin/demo.

I got an error message: demo failed: definition not found: demo

Digging around, I discovered the appbuilder info command, which has the following output

Choria Application Builder

        Debug Logging (BUILDER_DEBUG): false
  Configuration File (BUILDER_CONFIG): not specified
        Definition File (BUILDER_APP): not specified
                     Source Locations: /Users/robin/Library/Application Support/appbuilder, /etc/appbuilder

I put the command definition in /Users/robin/Library/Application Support/appbuilder and it works:

$ demo say "it works"
 __________
< it works >
 ----------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

It seems that the source directory ~/.config/appbuilder/ is not checked on MacOS.

I'm not sure if this is a documentation thing or a bug.

Add backoff options for exec

When a command fail it would be good to support retrying it on a backoff until success. We should log some details during retries and support customizable exit codes indicating success or fail, MVP might just go any !0 is bad though

Support configurable help template

The default fisk template is fine for big apps, but one might want to show the compact view for all sub commands or default kingpin, so I think this should be selectable per app

Support compile time app loading

It would be nice to use the appbuilder framework to embed apps into other fisk commands, or just to compile a app into a binary of its own.

Below we see we mount the app into the root of the cmd, if this is the getting started cowsay command then you would have:

% go run main.go
usage: testing [<flags>] <command> [<args> ...]

Testing

Commands:
  say    Say something using the configured command
  think  Think something using a cow

Pass --help to see global flags applicable to this command.

One can also make a cmd and mount it as a sub easily by just passing a *fisk.CmdClause instead of *fisk.Application

package main

import (
	"context"
	_ "embed"
	"os"

	"github.com/choria-io/appbuilder/builder"
	"github.com/choria-io/fisk"
)

//go:embed cowsay.yaml
var def []byte

func main() {
	builder.MustRegisterStandardCommands()

	cmd := fisk.Newf("testing", "Testing")

	err := builder.MountAsCommand(context.TODO(), cmd, def, nil)
	if err != nil {
		panic(err)
	}

	cmd.MustParseWithUsage(os.Args[1:])
}

How do I run multiple commands at once ?

Discussed in #62

Originally posted by nitrocode June 17, 2022

name: demo
description: demo
author: https://github.com/choria-io/appbuilder
type: parent

commands:
  - name: hi
    description: hi subcommands
    type: parent
    commands:
    - name: hello
      description: hello
      type: exec
      command: |
        echo "world"
        echo "hi"
$ demo hi hello
world echo hi

This is incorrect. This should echo world and then echo hi but instead it turns it all into a single line and executes only one command.

Is there a way to run multiple commands using a single command ?

Consider chainable transforms

Imagine we had a histogram transform and jq, we could:

transforms:
  - query: .replies.summaries.connected_server
  - histogram:
      title: Server Connections
      width: 20

To take a map[string]int and turn it into a histogram with that title thats 20 chars wide

Support cheats

Fisk.next will have native support for cheats, we should support adding them to commands

Show banner before prompt

$ sample basics confirm
? Are you sure you wish to execute the command Yes
>>>
>>> This command is potentially destructive and should only
>>> be run during maintenance windows.
>>>

execution confirmed, will run command

You should be able to use the banner to tell people why you're prompting etc

Add a scaffolding command

We should be able to scaffold many files using a command in a Tasfile, flags, arguments and other relavant details like working dir and app dir should be set as context and all files should be template parsed

name: scaffold
description: Creates an skeleton thing
arguments:
   - name: name
     description: The directory to create
     required: true

type: scaffold

# required, should not exist
target: /tmp/{{ .Arguments.Name }}

# where to find a directory full of files to base the scaffold from, supports templates
source_directory: /..../scaffold.source

# for smaller use cases one can instead specify the source in yaml here (ugh)
source:
  x.txt: |
    Content here ....
  foo: # a directory called foo with a file in it
    bar.txt: |
      Content here ...

# Post processes files matching with filepath.Match using shell commands
# if {} is in the string its replaced with path, if not path is appended as argument
post:
  - "*.go": gofmt -w {}
  - "*.go": goimports -w

Consider generating shell completions

Just like we have choria completion --zsh / choria completion --bash, it would be handy to have a similar way to generate completions with appbuilder.

Make the loader an injectable dependency

Today we support loading data from files, this mean the files has to be on every machine.

It would be good to support other modes at least in concept. Another tool like go-choria that embeds this might supply a config loader / app loader that uses the Choria KV as a source.

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.