vivainio / heymars

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Heymars

image

Heymars is a small, configurable launcher GUI for technical users.

Commands can be listed in a .txt, .json or .jsonnet file.

Overview

Here's what it looks like:

image

This was created from input json file:

{
   "commands": [
      {
         "fgcolor": "Blue",
         "id": "",
         "runtags": [
            "build"
         ],
         "title": "Basic heymars commands"
      },
      {
         "c": "dotnet build -c release Heymars.sln",
         "matchers": [
            {
               "log": true,
               "patterns": [
                  "^.*\\(\\d+,\\d+\\): error [A-Z]+\\d+: .*"
               ],
               "say": "Build failed",
               "status": "Build error"
            }
         ],
         "shell": true,
         "tags": [
            "build"
         ],
         "title": "Release build"
      },
      {
         "c": "jsonnet heymars_sample.jsonnet -o heymars_sample.json",
         "cwd": "Examples",
         "shell": true,
         "tags": [
            "build"
         ]
      },
      {
         "c": "npx quicktype heymars_sample.json --just-types --out=heymars_schema.ts",
         "cwd": "Examples",
         "shell": true,
         "title": "Create type definition with quicktype"
      },
      {
         "bgcolor": "yellow",
         "c": "code Examples/heymars_schema.ts",
         "shell": true
      }
   ],
   "root": ".."
}

Heymars directly supports running jsonnet files if you have jsonnet.exe installed. This json was generated with this jsonnet file:

{
    local Bat(cmd) = {
        c: cmd,
        shell: true
    },
    local Comm(title) = {
        title: title,
        fgcolor: "Blue",
        id: ""
    },

    local Msbuild(title, command) = {
        title: title,
        c: command,
        shell: true,
        matchers: [
            {

                patterns: [@"^.*\(\d+,\d+\): error [A-Z]+\d+: .*"],
                log: true,
                status: "Build error",
                say: "Build failed"
            }

        ]  
    },
    local sample = "heymars_sample",
    root: @"..",
    local tbuild = {
        tags: ["build"]
    },
    commands: [
        Comm("Basic heymars commands") + {runtags: ["build"]},
        Msbuild("Release build", "dotnet build -c release Heymars.sln") + tbuild,
        Bat("jsonnet %s.jsonnet -o %s.json" % [sample, sample]) + { cwd: "Examples" } + tbuild,
        Bat("npx quicktype heymars_sample.json --just-types --out=heymars_schema.ts") + {title: "Create type definition with quicktype", cwd: "Examples"},
        Bat("code Examples/heymars_schema.ts") + { bgcolor: "yellow"}
   ]
}

It is recommended to create your json files with jsonnet, to avoid repetition and e.g. reuse "C# error matchers" for different projects.

Here is the generated typescript schema you can use for quick reference.

For casual use, you can use plain text file as input. This file creates 4 commands:

echo hello
echo world
ls
pwd

You can gradually update to full blown json config by interleaving lines containing commands in json format:

echo hello
echo world
ls
{ "title": "More complex stuff you can fit on one line", "c": "echo foobar!", "fgcolor": "green", "id": "" }
pwd

License

MIT

About


Languages

Language:C# 98.7%Language:Python 1.2%Language:Batchfile 0.1%