{"id":30255267,"url":"https://github.com/wymli/makex","last_synced_at":"2026-05-09T03:35:23.501Z","repository":{"id":57691230,"uuid":"480265228","full_name":"wymli/makex","owner":"wymli","description":"It‘s a cmd-line tool like `make` and `task`, supporting nested args and alias using `cobra`. It's a makefile alternative and a shell wrapper.","archived":false,"fork":false,"pushed_at":"2022-05-11T14:58:05.000Z","size":4374,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-03T04:39:06.275Z","etag":null,"topics":["bash","cli","cobra","make","makefile","shell","task"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wymli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-11T07:07:01.000Z","updated_at":"2022-10-18T08:47:52.000Z","dependencies_parsed_at":"2022-08-27T19:41:23.641Z","dependency_job_id":null,"html_url":"https://github.com/wymli/makex","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wymli/makex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wymli%2Fmakex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wymli%2Fmakex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wymli%2Fmakex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wymli%2Fmakex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wymli","download_url":"https://codeload.github.com/wymli/makex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wymli%2Fmakex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32806104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli","cobra","make","makefile","shell","task"],"created_at":"2025-08-15T15:01:27.905Z","updated_at":"2026-05-09T03:35:23.481Z","avatar_url":"https://github.com/wymli.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# makex\nIt's a cmd-line tool like `make` and `task`, supporting nested options and alias using `cobra`.  \nWith `makex`, we can easily execute nested commands, like `makex cmd1`, `makex cmd1 cmd2`, which you defined yourself.\n\n## Usage\nyou can run `makex template init` to generate makexfile(`makex.yaml`) in `$pwd`, then you can edit your own makex.yaml and run with `makex`, just like `make in cobra style`  \n\nFor Example, given a following simple makexfile(makex.yaml)\n```yaml\ncmds:\n    - name: init\n      cmd: echo \"hello world: makex init\"\n      cmds:\n          - name: pb\n            cmd: echo \"hello world: makex init pb\"\n```\n\nyou can run `makex init` in the same dir of your `makex.yaml` to execute `init` commands, which is `echo \"hello world: makex init\"`. You can also run `makex init pb` to execute `echo \"hello world: makex init pb\"`.   \nTo get help info, you can run `makex help init (makex init -h, makex init --help)` to see help information. If `init` is an empty cmd, `makex init` will also print help info.\n\n\u003e Normally, you can just type `makex, makex help, makex -h, makex --help` to get help info.\n\n\u003e More cli usage, you can ask help for `cobra doc`.\n\n## Install\nYou can choose one of the three intsall methods.\n```sh\n# download release\ncurl -fsSL https://raw.githubusercontent.com/wymli/makex/master/install.sh | INSTALL_TYPE=release sh -\n# download source code and build from scratch\ncurl -fsSL https://raw.githubusercontent.com/wymli/makex/master/install.sh | INSTALL_TYPE=build sh -\n# use go install to download release to $GOPATH/bin, make sure you have set $GOPATH\ngo install github.com/wymli/makex@latest\n```\n\n## Example\n\nA `makefile` in `makex`, is named `makex.yaml`. We should place it in the root dir of your project.  \n\n[![asciicast](https://asciinema.org/a/486509.svg)](https://asciinema.org/a/486509)\n\n\nThis is the makexfile used in the video.\n``` yaml\ninterpreter: sh  # see https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html\n\n# user defined functions\nudfs:\n  - name: builtin   # this entry is just for promption, meaning we have `color` in builtin functions\n    prompt: color\n    used: false\n  - name: genpb\n    cmd: |\n      genpb(){\n        protoc -I $dir \\\n        --go_out $out_dir --go_opt paths=source_relative \\\n        --go-grpc_out $out_dir --go-grpc_opt paths=source_relative \\\n        *.proto\n      }\n\n# running with `makex init, makex tidy, makex userrpc build, makex userrpc build pb`\n# run `makex help` will give you a list\ncmds:\n  - name: init\n    cmd: |\n      go mod init github.com/wymli/makex_example\n  - name: tidy\n    cmd: |\n      go mod tidy\n  - name: userrpc\n    aliases: []\n    usage: userrpc is abould user center rpc\n    imports: []\n    cmds:\n      - name: build\n        aliases: [gen]\n        cmd: |\n          cd user_rpc\n          go build\n          # go build user_rpc/main.go -o bin/user_rpc\n        cmds:\n          - name: pb\n            imports: [genpb]\n            cmd: |\n              dir=.\n              out_dir=.\n              cd user_rpc/proto\n              genpb\n      - name: run\n        cmd: |\n          ./user_rpc/user_rpc\n```\n\n## Execute logic\nWe organize all shell commands into one big temp shell file.  \nWe first process imports in `cmd`\n- if the udf of imports has `cmd` field, we will copy `udf.cmd` to the shell file\n- if the udf of imports has `load` field, we will use `. ${udf.load}` to load file.\n\nThen we copy `cmd.cmd` to shell file and run it using a shell interpreter(default `sh`).\n\u003e You can see the whold tmp shell file if you running `makex` with `-v` flag\n\n## Makexfile(makex.yaml) Schema\n```\npackage parser\n\ntype Makexfile struct {\n\tInterpreter string `yaml:\"interpreter,omitempty\"`\n\tUdfs        []UDF  `yaml:\"udfs,omitempty\"`\n\tCmds        []Cmd  `yaml:\"cmds,omitempty\"`\n}\n\ntype UDF struct {\n\tName   string `yaml:\"name,omitempty\"`\n\tPrompt string `yaml:\"prompt,omitempty\"`\n\tCmd    string `yaml:\"cmd,omitempty\"`\n\tLoad   string `yaml:\"load,omitempty\"`\n\tUsed   *bool  `yaml:\"used,omitempty\"`\n}\n\ntype Cmd struct {\n\tName    string   `yaml:\"name,omitempty\"`\n\tAliases []string `yaml:\"aliases,omitempty\"`\n\tUsage   string   `yaml:\"usage,omitempty\"`\n\tImports []string `yaml:\"imports,omitempty\"`\n\tCmd     string   `yaml:\"cmd,omitempty\"`\n\tCmds    []Cmd    `yaml:\"cmds,omitempty\"`\n}\n```\n\n### UDF\nUDF can be seen as a kind of code snippets.\n\n- Name： used when imported in cmd (Cmd.Imports)\n- Prompt: useful information, like exported funtion name list\n- Cmd/Load: the payload, if cmd is not empty, we will exec cmd, otherwise will load shell file. cmd should be shell commands, and load should be shell file(relative to the makex.yaml)\n- Used: use or not\n\n### Cmd\nUsage is just like cobra.\n\n- Name: cmd name\n- Aliases: cmd alias\n- Usage: info showed in help usage\n- Imports: using udf\n- Cmd: command to execute\n- Cmds: sub-commands\n\n\n\n## Shell\nwe use [`sh`](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html), not `bash` or other shell.  \n\u003e you can change `interpreter` in `makex.yaml` easily, but normally builtin shell function is coded using `sh`\n\n\u003e a marked difference between different shell is that when showing color in echo, `sh` is just `echo` without -e, while `bash` needs `echo -e`\n\n\n## Config\nyou can configure you owm template on makexfile(makex.yaml), which is located at `$HOME/.makex/makex_config.yaml`.\n- do `cat ~/.makex/makex_config.yaml` for detail\n\nyou can store your own commonly used udf(code snippets) as builtin functions at `$HOME/.makex/shell/`\n- do `ls ~/.makex/shell/` for detail\n- each udf is organized as a file\n  - filename withoud ext is its import name\n  - a file can contains as many functions as you want\n  - we will load the whole file before `exec cmd`\n\n## Debug\n\nyou can run with `-v` to show debug logs. The contents of the assembled shell file will also be displayed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwymli%2Fmakex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwymli%2Fmakex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwymli%2Fmakex/lists"}