NeelBook 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global NeelBook --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local NeelBook --version 1.0.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=NeelBook&version=1.0.0                
nuke :add-package NeelBook --version 1.0.0                

NeelBook

This tool is to enable you to generate code based on configuration in json format

Commands

neelbook
neelbook new [name]
neelbook plugin list
neelbook plugin add [name]
neelbook plugin remove [name]
neelbook run

Updating templates

Basic Syntax

We have three kinds of contents:

  1. Normal text: this is the text will be printed to the outout documents without any processing
  2. Line statements: These are lines start with the code //##
  3. Inline statements: These are code between ((## and ##)) the code between them will be evaluated and printed automatically for example:
Normal text
//## LINE STATEMENT
Normal text ((## INLINE STATEMENT ##)) Normal text 
Normal text

Define Variable

You can define string, integers and json content formats like the following:

//## str myStringVar = "Hello world"
//## int myInteger = 5
//## json myJsonConfig = "./metadata.json"

When you declare json, the system will load its content to this variable

Assign Value to Variable

This is similar to declaration but no need to the variable type keyword:

//## myStringVar = "Hello world"
//## myInteger = 5
//## myJsonConfig = "./metadata.json"

You can also append value to string and integer variables:

//## myStringVar += " my dear"
//## myInteger = 3

To print out variables in the templates you can use print statement:

//## print myInteger
//## print myStringVar

You can add remarks to any statements using the keyword rem, so it will not be executed.

//## rem THIS WILL BE IGNORED

Controlling flow

You can use if statement as following:

//## if myInteger = 5
//## rem BEFORE END YOU CAN PUT IF BODY
//## end

//## if myInteger >= 5
//## rem BEFORE END YOU CAN PUT IF BODY
//## end

//## if myInteger <> 5
//## rem BEFORE END YOU CAN PUT IF BODY
//## end

//## if myStringVar = "Text goes here"
//## rem BEFORE END YOU CAN PUT IF BODY
//## end

You can use for statement as following:

//## for counter = 5
//## rem This will be executed 5 times
//## end

The starting value is one and the last value was speficied in the for declaration

You can access array in the json file and create loops using them like the following:

//## json myJsonFileContent = './myJsonFile.json'
//## foreach item = myJsonFileContent.array
//## rem Foreach body
//## end

Please not you can access sub array of other json elements like this:

//## json myJson = './myJsonFile.json'
//## foreach item = myJson.section1.subSection1.array
//## rem Foreach body
//## end

Control Output files

All output statements start with output keyword by default all output files will by located in output folder, the output filename by default will be the same source template file but without the extension ".t" This behavior can be customized using the output statements

Output Location

You can change the file name and file location using the following statement:

//## output location "./outout.cs" 

//## output location anyStringVariable 

That statement will override the distination file with the new file

Cancel the output override mode

To stop overriding files you can use this:

//##  output mode "DoNotOverride"

Output After

By default the output files will put output content in new file, but you can put the content inside the output file after speficit line using the following statement:

//## output after "//_some keyword in output file" 

//## output after anyStringVariable 

Please note that the output content will be checked not to be duplicated in the distination file

Output replace section

You can replace the whole section of content file if you provide both after and before keywords:

//## output after "//_begin block" 
//## output before "//_end block"
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.2 356 7/24/2021
1.0.1 346 7/23/2021
1.0.0 358 7/23/2021