From f168ef510096bcae21d87b7c5c85a4a8a55e5b4a Mon Sep 17 00:00:00 2001 From: Thomas Cherry Date: Wed, 6 Mar 2024 07:39:49 -0500 Subject: [PATCH] Adding support for lattest versions of go --- .gitignore | 1 + README.md | 10 ++++++++-- go.mod | 3 +++ run.sh | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 go.mod create mode 100755 run.sh diff --git a/.gitignore b/.gitignore index 7b3b5fa..1a8f0fa 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ _testmain.go *.exe *.test +gcss test/*.css cmd/gcss/test/*.css diff --git a/README.md b/README.md index bf9d78f..7acc6ed 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,15 @@ or $ cat /path/to/gcss/file | gcss > /path/to/css/file ``` -## Compile from Go programs +## Compile command locally -You can compile a GCSS file from Go programs by invoking the `gcss.CompileFile` function. +You can compile the command on the local system with the following: + +```$ go build -o gcss cmd/gcss/main.go``` + +## Compile/translate from Go programs + +You can compile/translate a GCSS file from Go programs by invoking the `gcss.CompileFile` function. ```go cssPath, err := gcss.CompileFile("path_to_gcss_file") diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..210df3d --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/yosssi/gcss + +go 1.22.0 diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..1c2faf4 --- /dev/null +++ b/run.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh + +# This script is primarily to document the development lifecycles of the app. +# Call ./run.sh -b to build the application +# Call ./run.sh -e for an example call +# Use ./run.sh -x --- to draw a line if you call the other two examples together + +# ############################################################################## + +usage() { + echo "Usage statment" + + format="%4s %-4s : %s\n" + printf "${format}" "Flag" "Arg" "Description" + printf "${format}" "----" "----" "----" + printf "${format}" "b" "" "Build command" + printf "${format}" "e" "" "Show a usage example" + printf "${format}" "x" "msg" "Prints out a message" +} + +# ############################################################################## + +# Behavior for no parameters +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +while getopts bex: opt ; do + case "${opt}" in + b) go build -o gcss cmd/gcss/main.go ;; + e) cat test/0001.gcss | ./gcss ;; + x) echo "${OPTARG}" ;; + *) usage ;; + esac +done