md-exec

command module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 4 Imported by: 0

README

Codacy Badge Codacy Badge GitHub All Releases

Feature

  • Support to run shell, python, Golang, and Groovy
  • Load multiple Markdown files

Usage

md-exec could exec the commands in the Markdown files. For instance, it will execute those commands which in Markdown block via mde README.md

#!title: Print ip info
ifconfig

Run in different shells:

#!title: Run in zsh
readlink /proc/$$/exe
#!title: Run in dash
readlink /proc/$$/exe

Variable input support

In some use cases, we need to change the variables or command line flags. Try the following demo:

#!title: Variable Input Hello World
name=linuxsuren
echo hello $name

Run in long time

#!title: Run long time
for i in 1 2 3 4 5
do
    echo $i
    sleep 1
done

Run Python Script

#!title: Python Hello World
print('hello python world');

Run Golang

#!title: Golang Hello World
fmt.Println("hello golang")

items := []int{1,2,3,4}
for _, item := range items {
    fmt.Println(item)
}

Run Groovy

#!title: Groovy Hello World
class Foo {
    void hello(){
        println "hello"
    }
}
new Foo().hello()

Limitation

Please make sure the Markdown files meet Linux end-of-line. You could turn it via: dos2unix your.md

Documentation

Overview

Package main is the entrypoint of this CLI project

Directories

Path Synopsis
Package cli contains all the command implements
Package cli contains all the command implements

Jump to

Keyboard shortcuts

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