commit b3aed80afd5260a161816caae21045cfd0434176 Author: Sangelo Date: Thu Oct 5 09:34:44 2023 +0200 Start work on dashinit, in nim. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..abb8bcf --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +# Ignore build directories +build/ +dist/ + +# Nim cache and generated files +nimcache/ +*.nimble-link +*.nim.cfg +*.nimble +*.so +*.dll +*.dylib +*.exe + +# Ignore specific NimScript files, but not config.nims +*.nims + +# Ignore VS Code settings +.vscode/ + +# Logs and databases +*.log +*.lst +*.db + +# Ignore any temporary files +*.tmp +*.swp +*.bak +*~ + +# If using nimpretty for code formatting +.nimpretty.cfg + +# Exclude project files +!config.nims +!dashinit.nimble \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b7d47b9 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# dashinit + +Simple yet powerful Rust powered templating tool. Fully configurable! + +## Table of contents + +- [dashinit](#dashinit) + - [Table of contents](#table-of-contents) + - [Install using script](#install-using-script) + - [Compile \& install manually](#compile--install-manually) + - [Update](#update) + - [Usage](#usage) + - [Uninstall](#uninstall) + +## Install using script + +Still not in usable state, instructions will follow. + +## Compile & install manually + +To compile `dashinit`, run the following command after cloning: + +```bash +# build a binary +nim build +``` + +## Update + +Still not in usable state, instructions will follow. + +## Usage + +To use niminit, run it inside the folder you'd like to initialise. +Optionally, you can pass the ``-g`` flag to also create a git repository. + +## Uninstall + +Still not in usable state, instructions will follow. + +--- +[Back to the top](#dashinit) \ No newline at end of file diff --git a/config.nims b/config.nims new file mode 100644 index 0000000..b8e919c --- /dev/null +++ b/config.nims @@ -0,0 +1,67 @@ +#### config.nims #### + +# Set some common options +switch("d", "release") +switch("hints", "off") + +# Helper procs to abstract away OS-specific commands +proc createDirectory(dir: string) = + when defined(windows): + exec "cmd /c mkdir " & dir + else: + exec "mkdir -p " & dir + +proc removeFileOrDir(path: string) = + when defined(windows): + if path.endsWith("/"): + exec "cmd /c rmdir /s /q " & path + else: + exec "cmd /c del /f /q " & path + else: + exec "rm -rf " & path + +# Build task for intermediate builds +task build, "Compile the project for intermediate builds": + createDirectory("build") ## Ensure the build directory exists + exec "nim c -o:build/dashinit src/main.nim" ## Compile the main project file into the build directory + +# Distribution task for final builds +task dist, "Compile the project for distribution": + createDirectory("dist") ## Ensure the directory exists + exec "nim c -o:dist/dashinit src/main.nim" ## Compile the main project file into the dist directory + +# Dev task (Compiles and runs main.nim) +task dev, "Run tests": + switch("undef", "release") ## Unset the release switch for this task + createDirectory("dev") ## Ensure dev directory exists + exec "nim c -o:dev/dashinit -r src/main.nim" + +# Clean task to remove generated files +task clean, "Clean up generated files": + removeFileOrDir("build/*") + removeFileOrDir("dist/*") + removeFileOrDir("dev/*") + +task deepclean, "Clean up by removing build/ and dist/ directories": + removeFileOrDir("build/") + removeFileOrDir("dist/") + removeFileOrDir("dev/") + + +#### Aliases #### + +# Build shorthand +task b, "Alias for build task": + exec "nim build" + +# Dist shorthand +task d, "Alias for dist task": + exec "nim dist" + +# Clean shorthand +task cl, "Alias for clean task": + exec "nim clean" + +# Deepclean shorthand +task dcl, "Alias for deep clean task": + exec "nim deepclean" \ No newline at end of file diff --git a/dashinit.nimble b/dashinit.nimble new file mode 100644 index 0000000..ccb0665 --- /dev/null +++ b/dashinit.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.1.0" +author = "Sangelo" +description = "A fast way to initialise all your projects!" +license = "MIT" +srcDir = "src" +bin = @["dashinit"] + + +# Dependencies + +requires "nim >= 2.0.0" diff --git a/src/main b/src/main new file mode 100755 index 0000000..acb28d7 Binary files /dev/null and b/src/main differ diff --git a/src/main.nim b/src/main.nim new file mode 100644 index 0000000..862d40c --- /dev/null +++ b/src/main.nim @@ -0,0 +1,5 @@ +# This is just an example to get you started. A typical binary package +# uses this file as the main entry point of the application. + +when isMainModule: + echo("Hello, World!")