cli

package module
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0 Imports: 38 Imported by: 0

README

Apex

noun

1. the top or highest part of something

language

2. a top-down / API-first description language for modeling and generating cloud-native applications

Goals:
  • Approachable
  • Protocol agnostic
  • Extensible
Problem

TODO

Solution

TODO

Overview

TODO

Installation

Windows

powershell -Command "iwr -useb https://raw.githubusercontent.com/apexlang/cli/main/install/install.ps1 | iex"

MacOS

curl -fsSL https://raw.githubusercontent.com/apexlang/cli/main/install/install.sh | /bin/bash

Linux

wget -q https://raw.githubusercontent.com/apexlang/cli/main/install/install.sh -O - | /bin/bash

Homebrew

brew install apexlang/tap/apex

Building a Module

TODO

Development

Prerequisites

Verify you have Go 1.17+ installed

go version

If Go is not installed, download and install Go 1.17+ (brew installation is not recommended because of CGO linker warnings)

Clone the project from github

git clone https://github.com/apexlang/apex.git
cd cli
go install ./cmd/...

Compiling on Windows

In order to build a project using v8go on Windows, Go requires a gcc compiler to be installed.

To set this up:

  1. Install MSYS2 (https://www.msys2.org/)
  2. Add the Mingw-w64 bin to your PATH environment variable (C:\msys64\mingw64\bin by default)
  3. Open MSYS2 MSYS and execute pacman -S mingw-w64-x86_64-toolchain

V8 requires 64-bit on Windows, therefore it will not work on 32-bit systems.

Confirm apex runs (The Go installation should add ~/go/bin in your PATH)

apex --help

Output:

Usage: apex <command>

Flags:
  -h, --help    Show context-sensitive help.

Commands:
  install <location> [<release>]
    Install a module.

  generate [<config>]
    Generate code from a configuration file.

  watch [<configs> ...]
    Watch configuration files for changes and trigger code generation.

  new <template> <dir> [<variables> ...]
    Creates a new project from a template.

  init <template> [<variables> ...]
    Initializes an existing project directory from a template.

  upgrade
    Upgrades to the latest base modules dependencies.

  version

Run "apex <command> --help" for more information on a command.

Built With

  • esbuild - An extremely fast JavaScript bundler written in Go that is used to compile the code generation TypeScript modules into JavaScript that can run natively in V8.
  • v8go and V8 - Execute JavaScript from Go
  • kong - A very simple and easy to use command-line parser for Go
  • The Go 1.16 embed package - Finally embedding files is built into the Go toolchain!

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE.txt file for details

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDependencies

func AddDependencies(dependencies map[string][]string)

func Astyle added in v0.1.13

func Astyle(source, options string) (string, error)

Types

type Command added in v0.1.6

type Command struct {
	Command string `json:"command" yaml:"command"`
	Dir     string `json:"dir" yaml:"dir"`
}

type Config

type Config struct {
	Spec      string                 `json:"spec" yaml:"spec"`
	Config    map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
	Generates map[string]Target      `json:"generates" yaml:"generates"`
}

type Context

type Context struct{}

type GenerateCmd

type GenerateCmd struct {
	Config string `arg:"" help:"The code generation configuration file" type:"existingfile" optional:""`
	// contains filtered or unexported fields
}

func (*GenerateCmd) Run

func (c *GenerateCmd) Run(ctx *Context) error

type InitCmd added in v0.1.3

type InitCmd struct {
	Template  string            `arg:"" help:"The template for the project to create." default:"@apexlang/basic"`
	Dir       string            `type:"existingdir" help:"The project directory" default:"."`
	Spec      string            `type:"existingfile" help:"An optional specification file to copy into the project"`
	Variables map[string]string `arg:"" help:"Variables to pass to the template." optional:""`
	// contains filtered or unexported fields
}

func (*InitCmd) Run added in v0.1.3

func (c *InitCmd) Run(ctx *Context) error

type InstallCmd

type InstallCmd struct {
	Location string `arg:"" help:"The NPM module or Github repository of the module to install."`
	Release  string `arg:"" help:"The release tag to install." optional:""`
	// contains filtered or unexported fields
}

func (*InstallCmd) Run

func (c *InstallCmd) Run(ctx *Context) error

type ListCmd added in v0.1.7

type ListCmd struct {
	Templates ListTemplatesCmd `cmd:"templates" help:"Lists installed templates"`
}

type ListTemplatesCmd added in v0.1.7

type ListTemplatesCmd struct {
}

func (*ListTemplatesCmd) Run added in v0.1.7

func (c *ListTemplatesCmd) Run(ctx *Context) error

type NewCmd

type NewCmd struct {
	Template  string            `arg:"" help:"The template for the project to create."`
	Dir       string            `arg:"" help:"The project directory"`
	Spec      string            `type:"existingfile" help:"An optional specification file to copy into the project"`
	Variables map[string]string `arg:"" help:"Variables to pass to the template." optional:""`
}

func (*NewCmd) Run

func (c *NewCmd) Run(ctx *Context) error

type Package added in v0.1.11

type Package struct {
	Version    string `json:"version"`
	Resolved   string `json:"resolved"`
	Integrity  string `json:"integrity"`
	Dev        bool   `json:"dev"`
	Extraneous bool   `json:"extraneous"`
}

type Shrinkwrap added in v0.1.11

type Shrinkwrap struct {
	Name            string             `json:"name"`
	Version         string             `json:"version"`
	LockfileVersion int                `json:"lockfileVersion"`
	Requires        bool               `json:"requires"`
	Packages        map[string]Package `json:"packages"`
	Dependencies    map[string]Package `json:"dependencies"`
}

type Target

type Target struct {
	Module       string                 `json:"module" yaml:"module"`
	VisitorClass string                 `json:"visitorClass" yaml:"visitorClass"`
	IfNotExists  bool                   `json:"ifNotExists,omitempty" yaml:"ifNotExists,omitempty"`
	Executable   bool                   `json:"executable,omitempty" yaml:"executable,omitempty"`
	Config       map[string]interface{} `json:"config,omitempty" yaml:"config,omitempty"`
	RunAfter     []Command              `json:"runAfter" yaml:"runAfter"`
}

type Template

type Template struct {
	Name         string     `json:"name" yaml:"name"`
	Description  string     `json:"description" yaml:"description"`
	Variables    []Variable `json:"variables" yaml:"variables"`
	SpecLocation string     `json:"specLocation" yaml:"specLocation"`
}

type UpgradeCmd

type UpgradeCmd struct {
}

func (*UpgradeCmd) Run

func (c *UpgradeCmd) Run(ctx *Context) error

type Variable

type Variable struct {
	Name        string `json:"name" yaml:"name"`
	Description string `json:"description" yaml:"description"`
	Prompt      string `json:"prompt" yaml:"prompt"`
	Default     string `json:"default" yaml:"default"`
	Required    bool   `json:"required" yaml:"required"`
	Loop        bool   `json:"loop" yaml:"loop"`
}

type WatchCmd

type WatchCmd struct {
	Configs []string `arg:"" help:"The code generation configuration files" type:"existingfile" optional:""`
}

func (*WatchCmd) Run

func (c *WatchCmd) Run(ctx *Context) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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