From 98742fc318e6809bc38593ae94c79ae74c8e5996 Mon Sep 17 00:00:00 2001
From: Damian <demonnic@gmail.com>
Date: Tue, 12 Dec 2023 01:10:35 -0500
Subject: [PATCH] initial commit

---
 .github/workflows/ci.yml | 25 +++++++++++++++++++
 .gitignore               |  5 ++++
 README.md                | 54 ++++++++++++++++++++++++++++++++++++++++
 mfile                    |  6 +++++
 src/aliases/`cecho.lua   |  5 ++++
 src/aliases/`decho.lua   |  5 ++++
 src/aliases/`echo.lua    |  5 ++++
 src/aliases/`hecho.lua   |  5 ++++
 src/aliases/aliases.json | 18 ++++++++++++++
 9 files changed, 128 insertions(+)
 create mode 100644 .github/workflows/ci.yml
 create mode 100644 .gitignore
 create mode 100644 README.md
 create mode 100644 mfile
 create mode 100644 src/aliases/`cecho.lua
 create mode 100644 src/aliases/`decho.lua
 create mode 100644 src/aliases/`echo.lua
 create mode 100644 src/aliases/`hecho.lua
 create mode 100644 src/aliases/aliases.json

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..4a30576
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,25 @@
+name: CI
+
+on:
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ main ]
+
+  workflow_dispatch:
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Muddle
+        uses: demonnic/build-with-muddler@v1.3
+
+      - name: Upload MPackage
+        uses: actions/upload-artifact@v2
+        with:
+          name: run-lua-code
+          path: build/tmp/
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bdd525f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.vscode/
+build/
+sub-projects/
+doc/
+.output
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3a43d4d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,54 @@
+# Echo Package
+
+The echo package provides a means of testing triggers via the command line with four command aliases;
+`` `echo, `cecho, `decho, `hecho``.  
+
+All act as if the given text came from the game itself and will fire any matching triggers.  
+
+See [Triggers](https://wiki.mudlet.org/w/Manual:Introduction#Triggers) for further information on matching text.
+  
+## `echo Alias
+
+Displays text on the screen and tells all matching triggers to fire.  For coloring use one
+of the other functions mentioned below.
+
+```txt
+-- examples
+> `echo text - displays text on the main screen and tells all matching triggers to fire
+> `echo This is a sample line from the game$$And this is a new line.
+```
+
+See [echo](https://wiki.mudlet.org/w/Manual:Lua_Functions#echo), [feedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#feedTriggers), 
+  
+## `cecho Alias
+
+Like echo, but you can add color information using color names and ANSI values.
+
+```txt
+-- example: color format is <foreground:background>
+> `cecho <green:red>green on red<r> reset$$<124:100>foreground of ANSI124 and background of ANSI100<r>
+```
+
+See [cecho](https://wiki.mudlet.org/w/Manual:Lua_Functions#cecho), [cfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#cfeedTriggers).
+
+## `decho Alias
+
+Like cecho, but you can add color information using <r,g,b> format.
+
+```txt
+-- example
+> `decho <0,128,0:128,0,0>green on red<r> reset
+```
+
+See [decho](https://wiki.mudlet.org/w/Manual:Lua_Functions#decho), [dfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#dfeedTriggers).
+
+## `hecho Alias
+
+Like cecho, but you can add color information using hex #RRGGBB format.
+
+```txt
+-- example
+> `hecho #008000,800000green on red#r reset
+```
+
+See [hecho](https://wiki.mudlet.org/w/Manual:Lua_Functions#hecho), [hfeedTriggers](https://wiki.mudlet.org/w/Manual:Lua_Functions#hfeedTriggers).
\ No newline at end of file
diff --git a/mfile b/mfile
new file mode 100644
index 0000000..e4836be
--- /dev/null
+++ b/mfile
@@ -0,0 +1,6 @@
+{
+  "package": "echo",
+  "version": "1.0",
+  "author": "Mudlet",
+  "title": "A set of aliases to test triggers on the command line."
+}
diff --git a/src/aliases/`cecho.lua b/src/aliases/`cecho.lua
new file mode 100644
index 0000000..9f75801
--- /dev/null
+++ b/src/aliases/`cecho.lua
@@ -0,0 +1,5 @@
+local s = matches[2]
+
+s = string.gsub(s, "%$", "\n")
+cfeedTriggers("\n" .. s .. "\n")
+echo("\n")
\ No newline at end of file
diff --git a/src/aliases/`decho.lua b/src/aliases/`decho.lua
new file mode 100644
index 0000000..8431cd9
--- /dev/null
+++ b/src/aliases/`decho.lua
@@ -0,0 +1,5 @@
+local s = matches[2]
+
+s = string.gsub(s, "%$", "\n")
+dfeedTriggers("\n" .. s .. "\n")
+echo("\n")
\ No newline at end of file
diff --git a/src/aliases/`echo.lua b/src/aliases/`echo.lua
new file mode 100644
index 0000000..e1a8fac
--- /dev/null
+++ b/src/aliases/`echo.lua
@@ -0,0 +1,5 @@
+local s = matches[2]
+
+s = string.gsub(s, "%$", "\n")
+feedTriggers("\n" .. s .. "\n")
+echo("\n")
\ No newline at end of file
diff --git a/src/aliases/`hecho.lua b/src/aliases/`hecho.lua
new file mode 100644
index 0000000..53fed08
--- /dev/null
+++ b/src/aliases/`hecho.lua
@@ -0,0 +1,5 @@
+local s = matches[2]
+
+s = string.gsub(s, "%$", "\n")
+hfeedTriggers("\n" .. s .. "\n")
+echo("\n")
\ No newline at end of file
diff --git a/src/aliases/aliases.json b/src/aliases/aliases.json
new file mode 100644
index 0000000..18943a6
--- /dev/null
+++ b/src/aliases/aliases.json
@@ -0,0 +1,18 @@
+[
+  {
+    "name": "`echo",
+    "regex": "`echo (.+)"
+  },
+  {
+    "name": "`cecho",
+    "regex": "`cecho (.+)"
+  },
+  {
+    "name": "`decho",
+    "regex": "`decho (.+)"
+  },
+  {
+    "name": "`hecho",
+    "regex": "`hecho (.+)"
+  }
+]
\ No newline at end of file