Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

3JoB/gmake2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMake2

A make-like program, forked from https://github.com/fdxxw/gmake .

This branch extends some functionality.

Menu

Installing

Download the latest version from github.

go get -u github.com/3JoB/gmake2

Getting Started

Write the gmake.yml file in the current directory, the content is as follows

vars:
  msg: Hello World

all: |
  @echo {{.msg}}

mg: |
  @echo What's up???

Then run gmake on the current command line console, you can see the console print

Hello World

Or execute gmake mg to execute the specified command, and the console will print

What's up???

gmake2 automatically selects the all command when no command is specified.

Features

build-in command

The built-in command is as follows

@echo

Print information

@echo msg

@var

Set variable

@var msg Hello World

or

vars:
  msg: Hello World

all: |
  @echo {{.msg}}

@env

Set environment variables

@env GOOS linux

@cmd

Execute other configured commands.

Example:

all: |
  @cmd readme

readme: |
  @echo I Like It

comment

# Begins with comments

# comment

@touch

Create a file

@touch from.txt

@mv

Move a file or directory

@mv from.txt to.txt

@copy

Copy a file or directory

@copy to.txt from.txt

@rm

Delete file or directory

@rm from.txt

@mkdir

Create a directory

@mkdir from

@cd

Set the directory to make subsequent console commands run in the specified directory. It is only valid for system commands and invalid for built-in commands.

@cd from

system command

System commands, execute console commands, and execute everything that the console can execute.

go build

examples

examples.yml

vars:
  msg: Hello World
all: |
  @echo {{.msg}}
  # Modify the msg variable
  @var msg Hello
  @echo {{.msg}}
  # Create a file
  @touch from.txt
  @mv from.txt to.txt
  @copy to.txt from.txt
  @rm from.txt
  @rm to.txt
  @mkdir from
  @mv from to
  @copy to from
  @rm from
  @rm to
  @env GOOS linux
  go build
gmake