UNPKG

4.81 kBMarkdownView Raw
1# makensis-cli
2
3[![npm](https://img.shields.io/npm/l/makensis-cli.svg?style=flat-square)](https://www.npmjs.org/package/makensis-cli)
4[![npm](https://img.shields.io/npm/v/makensis-cli.svg?style=flat-square)](https://www.npmjs.org/package/makensis-cli)
5[![Travis](https://img.shields.io/travis/idleberg/node-makensis-cli.svg?style=flat-square)](https://travis-ci.org/idleberg/node-makensis-cli)
6[![David](https://img.shields.io/david/idleberg/node-makensis-cli.svg?style=flat-square)](https://david-dm.org/idleberg/node-makensis-cli)
7[![David](https://img.shields.io/david/dev/idleberg/node-makensis-cli.svg?style=flat-square)](https://david-dm.org/idleberg/node-makensis-cli?type=dev)
8
9CLI for the makensis wrapper on Node
10
11## Why?
12
13Admittedly, there are only few reasons why you would want to use a wrapper for an already existing CLI application.
14
15**Pros:**
16
17- seamless [Wine](http://winehq.org/) integration
18- Unix-like command-line parameters
19- normalized output
20- optional JSON output
21
22**Cons:**
23
24- redundancy
25
26## Prerequisites
27
28Make sure that NSIS is properly installed with `makensis` in your PATH [environmental variable](http://superuser.com/a/284351/195953).
29
30On non-Windows platforms, you can usually install NSIS with your package manager:
31
32```sh
33# Debian
34sudo apt-get -t experimental install nsis
35
36# Red Hat
37sudo dnf install nsis
38
39# Homebrew
40brew install nsis
41
42# MacPorts
43port install nsis
44```
45
46Alternatively, you can setup NSIS in your [Wine](http://winehq.org/) environment. Keep in mind that Wine writes standard streams while running `makensis`, so additional parsing of the compiler output might be necessary.
47
48## Installation
49
50`$ npm install makensis-cli --global`
51
52## Usage
53
54You can evoke this wrapper using `nsis` or, since Windows users already have `NSIS.exe` in the PATH, using the `nn` shorthand.
55
56### Sub-Commands
57
58- `hdrinfo` – prints information about what options makensis was compiled with (Aliases: `f|flags|i|info`)
59- `version` – prints the makensis version and exits (Alias: `v`)
60- `cmdhelp [item]` – prints out help for 'item', or lists all commands
61
62### Options
63
64Running `nsis --help` lists all available options:
65
66```
67Usage: nsis [command] [file.nsi] [options]
68
69Options:
70
71 -V, --version output the version number
72 -i, --input-charset <string> ACP|OEM|CP#|UTF8|UTF16<LE|BE>
73 -j, --json prints output as JSON
74 -p, --pause pauses after execution
75 -o, --output-charset <string> ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]
76 -P, --ppo preprocess to stdout/file
77 -S, --safe-ppo preprocess to stdout/file
78 -v, --verbose <n> verbosity where n is 4=all,3=no script,2=no info,1=no warnings,0=none
79 -w, --wine use Wine to run makenis
80 -x, --strict treat warnings as errors
81 -h, --help output usage information
82```
83
84**Examples:**
85
86Let's start with `makensis` returning its version
87
88```sh
89$ nsis version
90
91# Result:
92#
93# v3.02.1
94```
95____
96
97We can also return this as JSON
98
99```sh
100$ nsis version --json
101
102# Result:
103#
104# {
105# "version": "3.02.1"
106# }
107```
108____
109
110Try again for `makensis` on Wine
111
112```sh
113$ nsis version --json --wine
114
115# Result:
116#
117# {
118# "version": "3.01"
119# }
120```
121____
122
123In the following steps we're going to need a demo script, so let's create one. Take special note of the `!warning` inside the section.
124
125```sh
126$ printf "OutFile demo.exe\n\nSection\n!warning\nSectionEnd" > demo.nsi
127```
128____
129
130Compile the script
131
132```sh
133$ nsis demo.nsi
134
135# Result (omitted):
136#
137# EXE header size: 36352 / 37888 bytes
138# Install code: 399 / 1999 bytes
139# Install data: 0 / 0 bytes
140# CRC (0x027F605B): 4 / 4 bytes
141# Total size: 36755 / 39891 bytes (92.1%)
142# 1 warning:
143# !warning: (demo.nsi:4)
144```
145____
146
147Compile again, but only display warnings and errors
148
149```sh
150$ nsis demo.nsi --verbose 2
151
152# Result:
153#
154# warning: !warning: (demo.nsi:4)
155# 1 warning:
156# !warning: (demo.nsi:4)
157```
158____
159
160Complie with strict settings, so our little `!warning` will be treated as an error.
161
162```sh
163$ nsis demo.nsi --verbose 2 --strict
164
165# Result:
166#
167# Exit Code 1
168# Error: warning treated as error
169```
170____
171
172Let's output the above as JSON
173
174```sh
175$ nsis demo.nsi --verbose 2 --strict --json
176
177# Result:
178#
179# {
180# "status": 1,
181# "stdout": "warning: !warning: (demo.nsi:4)",
182# "stderr": "Error: warning treated as error",
183# "warnings": 1
184# }
185```
186
187## License
188
189This work is licensed under [The MIT License](https://opensource.org/licenses/MIT)
190
191## Donate
192
193You are welcome support this project using [Flattr](https://flattr.com/submit/auto?user_id=idleberg&url=https://github.com/idleberg/node-makensis-cli) or Bitcoin `17CXJuPsmhuTzFV2k4RKYwpEHVjskJktRd`