UNPKG

4.67 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
54### Sub-Commands
55
56- `hdrinfo` – prints information about what options makensis was compiled with (Aliases: `f|flags|i|info`)
57- `version` – prints the makensis version and exits (Alias: `v`)
58- `cmdhelp [item]` – prints out help for 'item', or lists all commands
59
60### Options
61
62Running `nsis --help` lists all available options:
63
64```
65Usage: nsis [command] [file.nsi] [options]
66
67Options:
68
69 -V, --version output the version number
70 -i, --input-charset <string> ACP|OEM|CP#|UTF8|UTF16<LE|BE>
71 -j, --json prints output as JSON
72 -p, --pause pauses after execution
73 -o, --output-charset <string> ACP|OEM|CP#|UTF8[SIG]|UTF16<LE|BE>[BOM]
74 -P, --ppo preprocess to stdout/file
75 -S, --safe-ppo preprocess to stdout/file
76 -v, --verbose <n> verbosity where n is 4=all,3=no script,2=no info,1=no warnings,0=none
77 -w, --wine use Wine to run makenis
78 -x, --strict treat warnings as errors
79 -h, --help output usage information
80```
81
82**Examples:**
83
84Let's start with `makensis` returning its version
85
86```sh
87$ nsis version
88
89# Result:
90#
91# v3.02.1
92```
93____
94
95We can also return this as JSON
96
97```sh
98$ nsis version --json
99
100# Result:
101#
102# {
103# "version": "3.02.1"
104# }
105```
106____
107
108Try again for `makensis` on Wine
109
110```sh
111$ nsis version --json --wine
112
113# Result:
114#
115# {
116# "version": "3.01"
117# }
118```
119____
120
121In 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.
122
123```sh
124$ printf "OutFile demo.exe\n\nSection\n!warning\nSectionEnd" > demo.nsi
125```
126____
127
128Compile the script
129
130```sh
131$ nsis demo.nsi
132
133# Result (omitted):
134#
135# EXE header size: 36352 / 37888 bytes
136# Install code: 399 / 1999 bytes
137# Install data: 0 / 0 bytes
138# CRC (0x027F605B): 4 / 4 bytes
139# Total size: 36755 / 39891 bytes (92.1%)
140# 1 warning:
141# !warning: (demo.nsi:4)
142```
143____
144
145Compile again, but only display warnings and errors
146
147```sh
148$ nsis demo.nsi --verbose 2
149
150# Result:
151#
152# warning: !warning: (demo.nsi:4)
153# 1 warning:
154# !warning: (demo.nsi:4)
155```
156____
157
158Complie with strict settings, so our little `!warning` will be treated as an error.
159
160```sh
161$ nsis demo.nsi --verbose 2 --strict
162
163# Result:
164#
165# Exit Code 1
166# Error: warning treated as error
167```
168____
169
170Let's output the above as JSON
171
172```sh
173$ nsis demo.nsi --verbose 2 --strict --json
174
175# Result:
176#
177# {
178# "status": 1,
179# "stdout": "warning: !warning: (demo.nsi:4)",
180# "stderr": "Error: warning treated as error"
181# }
182```
183
184## License
185
186This work is licensed under [The MIT License](https://opensource.org/licenses/MIT)
187
188## Donate
189
190You 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`