about summary refs log tree commit diff stats
path: root/Makefile
Commit message (Expand)AuthorAgeFilesLines
* thx to Toni Lainsonarg@suckless.org2007-10-191-2/+2
* removed dwm.h, just include C-files in config.h if you extend dwm, that's sim...arg@suckless.org2007-10-181-2/+2
* recreated dwm.hAnselm R. Garbe2007-10-111-1/+1
* renamed config.h into config.def.h, config.h will be created if not present, ...Anselm R. Garbe2007-09-231-1/+5
* made all stuff non-static - so you can choose wether to use dwm the static or...arg@suckless.org2007-09-171-1/+1
* micromizing dwm step 1Anselm R. Garbe2007-09-151-3/+3
* moved bar-related stuff to bar.c (merged draw.c into that)Anselm R. Garbe2007-09-151-1/+1
* renamed config.default.h into config.hAnselm R. Garbe2007-09-151-5/+1
* dist target only needs to add config.default.hAnselm R. Garbe2007-09-151-1/+1
* added screen.c, removed layout.c and tag.cAnselm R. Garbe2007-08-191-1/+1
* fififiAnselm R. Garbe2007-08-151-1/+1
* separated layout-specific stuff into separate .h and .c files which are inclu...Anselm R. Garbe2007-08-111-1/+1
* removed strip, added -s to LDFLAGSAnselm R. Garbe2007-05-151-1/+0
* yet another fix of copyright compactisitionAnselm R. Garbe2007-04-131-1/+1
* fixed quoting and a comment 3.6Anselm R. Garbe2007-02-211-1/+1
* added draw.c again (except getcolor and setfont which are helpers in main.c)Anselm R. Garbe2007-02-201-1/+1
* split screen.c into layout.c and tag.c (because the view is an implicit mixtu...Anselm R. Garbe2007-02-201-1/+1
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-1/+1
* renamed view.c into screen.cAnselm R. Garbe2007-02-191-1/+1
* merged tag.c, view.c and tile.c to manage.cAnselm R. Garbe2007-02-191-1/+1
* introduced tile.c, some refactoring of functionsAnselm R. Garbe2007-02-191-1/+1
* fixed copyright notice in MakefileAnselm R. Garbe2007-02-081-1/+1
* got rid of LD (inspired by JGs patch to wmii)Anselm R. Garbe2007-02-051-3/+2
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
* separated several functions into view.cAnselm R. Garbe2006-08-221-1/+1
* removed finished messageAnselm R.Garbe2006-08-141-1/+0
* applied Sanders LD and resize patchesAnselm R.Garbe2006-08-141-1/+2
* applied Sanders tiny patchesAnselm R.Garbe2006-08-081-1/+1
* typo fixarg@10ksloc.org2006-08-071-1/+1
* applied Sanders man page/Makefile patcharg@10ksloc.org2006-08-071-1/+1
* added stripping to dwm target in Makefilearg@10ksloc.org2006-08-071-0/+1
* removed CONFIGarg@10ksloc.org2006-08-031-3/+2
* make config.h not a time dependencearg@10ksloc.org2006-08-031-1/+1
* removed rm config.h from cleanarg@10ksloc.org2006-08-031-1/+1
* added gmake compliancearg@10ksloc.org2006-08-031-2/+2
* applied Jukka's diffarg@10ksloc.org2006-08-031-4/+5
* applied Sanders Makefile patcharg@10ksloc.org2006-08-031-26/+20
* using SRC instead of *.carg@10ksloc.org2006-08-031-1/+1
* changed the files included in make distarg@10ksloc.org2006-08-031-1/+2
* applied Sanders doc changes, added a PHONY line and changed the output of con...arg@10ksloc.org2006-08-031-1/+4
* implemented the idea presented by Sander for dwm targetarg@10ksloc.org2006-08-021-1/+4
* applied Sanders patchesarg@10ksloc.org2006-08-011-2/+1
* makefile now sets permissions for executables and man pagesarg@10ksloc.org2006-07-201-0/+6
* simplified MakefileAnselm R. Garbe2006-07-171-2/+2
* rearranged several stuffAnselm R. Garbe2006-07-151-1/+1
* rearrangedAnselm R. Garbe2006-07-141-1/+1
* draw bar on exposure ;)Anselm R. Garbe2006-07-141-1/+1
* prep 0.1 0.1Anselm R. Garbe2006-07-141-1/+1
* implemented bar for dwm (I miss status text), I plan that status text is read...Anselm R. Garbe2006-07-141-1/+1
* changed default colorsAnselm R. Garbe2006-07-131-2/+2
Multimethods are not available. * ``random.randomize()`` requires an ``int64`` explicitly passed as argument, you *must* pass a Seed integer. * ``unicode`` can be imported, but not ``unidecode``. Standard library modules ======================== At least the following standard library modules are available: * `macros <macros.html>`_ * `os <os.html>`_ * `strutils <strutils.html>`_ * `math <math.html>`_ * `distros <distros.html>`_ * `sugar <sugar.html>`_ * `algorithm <algorithm.html>`_ * `base64 <base64.html>`_ * `bitops <bitops.html>`_ * `chains <chains.html>`_ * `colors <colors.html>`_ * `complex <complex.html>`_ * `htmlgen <htmlgen.html>`_ * `httpcore <httpcore.html>`_ * `lenientops <lenientops.html>`_ * `mersenne <mersenne.html>`_ * `options <options.html>`_ * `parseutils <parseutils.html>`_ * `punycode <punycode.html>`_ * `random <punycode.html>`_ * `stats <stats.html>`_ * `strformat <strformat.html>`_ * `strmisc <strmisc.html>`_ * `strscans <strscans.html>`_ * `unicode <unicode.html>`_ * `uri <uri.html>`_ * `std/editdistance <editdistance.html>`_ * `std/wordwrap <wordwrap.html>`_ * `std/sums <sums.html>`_ In addition to the standard Nim syntax (`system <system.html>`_ module), NimScripts support the procs and templates defined in the `nimscript <nimscript.html>`_ module too. NimScript as a configuration file ================================= A command-line switch ``--FOO`` is written as ``switch("FOO")`` in NimScript. Similarly, command-line ``--FOO:VAL`` translates to ``switch("FOO", "VAL")``. Here are few examples of using the ``switch`` proc: .. code-block:: nim # command-line: --opt:size switch("opt", "size") # command-line: --define:foo or -d:foo switch("define", "foo") # command-line: --forceBuild switch("forceBuild") NimScripts also support ``--`` templates for convenience, which look like command-line switches written as-is in the NimScript file. So the above example can be rewritten as: .. code-block:: nim --opt:size --define:foo --forceBuild **Note**: In general, the *define* switches can also be set in NimScripts using ``switch`` or ``--``, as shown in above examples. Only the ``release`` define (``-d:release``) cannot be set in NimScripts. NimScript as a build tool ========================= The ``task`` template that the ``system`` module defines allows a NimScript file to be used as a build tool. The following example defines a task ``build`` that is an alias for the ``c`` command: .. code-block:: nim task build, "builds an example": setCommand "c" In fact, as a convention the following tasks should be available: ========= =================================================== Task Description ========= =================================================== ``help`` List all the available NimScript tasks along with their docstrings. ``build`` Build the project with the required backend (``c``, ``cpp`` or ``js``). ``tests`` Runs the tests belonging to the project. ``bench`` Runs benchmarks belonging to the project. ========= =================================================== Look at the module `distros <distros.html>`_ for some support of the OS's native package managers. Nimble integration ================== See the `Nimble readme <https://github.com/nim-lang/nimble#readme>`_ for more information. Standalone NimScript ==================== NimScript can also be used directly as a portable replacement for Bash and Batch files. Use ``nim myscript.nims`` to run ``myscript.nims``. For example, installation of Nimble could be accomplished with this simple script: .. code-block:: nim mode = ScriptMode.Verbose var id = 0 while dirExists("nimble" & $id): inc id exec "git clone https://github.com/nim-lang/nimble.git nimble" & $id withDir "nimble" & $id & "/src": exec "nim c nimble" mvFile "nimble" & $id & "/src/nimble".toExe, "bin/nimble".toExe On Unix, you can also use the shebang ``#!/usr/bin/env nim``, as long as your filename ends with ``.nims``: .. code-block:: nim #!/usr/bin/env nim mode = ScriptMode.Silent echo "hello world" Use ``#!/usr/bin/env -S nim --hints:off`` to disable hints. Benefits ======== Cross-Platform -------------- It is a cross-platform scripting language that can run where Nim can run, e.g. you can not run Batch or PowerShell on Linux or Mac, the Bash for Linux might not run on Mac, there are no unit tests tools for Batch, etc. NimScript can detect on which platform, operating system, architecture, and even which Linux distribution is running on, allowing the same script to support a lot of systems. See the following (incomplete) example: .. code-block:: nim import distros # Architectures. if defined(amd64): echo "Architecture is x86 64Bits" elif defined(i386): echo "Architecture is x86 32Bits" elif defined(arm): echo "Architecture is ARM" # Operating Systems. if defined(linux): echo "Operating System is GNU Linux" elif defined(windows): echo "Operating System is Microsoft Windows" elif defined(macosx): echo "Operating System is Apple OS X" # Distros. if detectOs(Ubuntu): echo "Distro is Ubuntu" elif detectOs(ArchLinux): echo "Distro is ArchLinux" elif detectOs(Debian): echo "Distro is Debian" Uniform Syntax -------------- The syntax, style, and rest of the ecosystem is the same as for compiled Nim, that means there is nothing new to learn, no context switch for developers. Powerful Metaprogramming ------------------------ NimScript can use Nim's templates, macros, types, concepts, effect tracking system, and more, you can create modules that work on compiled Nim and also on interpreted NimScript. ``func`` will still check for side effects, ``debugEcho`` also works as expected, making it ideal for functional scripting metaprogramming. This is an example of a third party module that uses macros and templates to translate text strings on unmodified NimScript: .. code-block:: nim import nimterlingua nimterlingua("translations.cfg") echo "cat" # Run with -d:RU becomes "kot", -d:ES becomes "gato", ... translations.cfg .. code-block:: none [cat] ES = gato PT = minino RU = kot FR = chat * `Nimterlingua <https://nimble.directory/pkg/nimterlingua>`_ Graceful Fallback ----------------- Some features of compiled Nim may not work on NimScript, but often a graceful and seamless fallback degradation is used. See the following NimScript: .. code-block:: nim if likely(true): discard elif unlikely(false): discard proc foo() {.compiletime.} = echo NimVersion static: echo CompileDate ``likely()``, ``unlikely()``, ``static:`` and ``{.compiletime.}`` will produce no code at all when run on NimScript, but still no error nor warning is produced and the code just works. Evolving Scripting language --------------------------- NimScript evolves together with Nim, `occasionally new features might become available on NimScript <https://github.com/nim-lang/Nim/pulls?utf8=%E2%9C%93&q=nimscript>`_ , adapted from compiled Nim or added as new features on both. Scripting Language with a Package Manager ----------------------------------------- You can create your own modules to be compatible with NimScript, and check `Nimble <https://nimble.directory>`_ to search for third party modules that may work on NimScript. DevOps Scripting ---------------- You can use NimScript to deploy to production, run tests, build projects, do benchmarks, generate documentation, and all kinds of DevOps/SysAdmin specific tasks. * `An example of a third party NimScript that can be used as a project-agnostic tool. <https://github.com/kaushalmodi/nim_config#list-available-tasks>`_