forked from cleishm/libneo4j-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neo4j-client.1.in
255 lines (241 loc) · 9.53 KB
/
neo4j-client.1.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
.\" @configure_input@
.\"
.\" neo4j-client - command shell for Neo4j
.\" Copyright 2016 Chris Leishman (http://github.com/cleishm)
.\"
.\" Licensed under the Apache License, Version 2.0 (the "License");
.\" you may not use this file except in compliance with the License.
.\" You may obtain a copy of the License at
.\"
.\" http://www.apache.org/licenses/LICENSE-2.0
.\"
.\" Unless required by applicable law or agreed to in writing, software
.\" distributed under the License is distributed on an "AS IS" BASIS,
.\" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
.\" See the License for the specific language governing permissions and
.\" limitations under the License.
.\"
.TH NEO4J-CLIENT 1
.SH NAME
neo4j\-client \- command shell for Neo4j
.SH SYNOPSIS
.B neo4j\-client \fI[options...] [URL | host[:port]]\fR
.SH "DESCRIPTION"
\fBneo4j\-client\fR is a command shell for Neo4j. It supports secure
connections to Neo4j server, sending of statements (including multiline
statements), persistent command history, and rendering of results to tables or
CSV.
\fBneo4j\-client\fR requires Neo4j Server version 3.0 or later.
.SH OPTIONS
.TP
.I \-\-help, \-h
Display a brief help listing.
.TP
.I \-\-history=file
Use the specified file for saving history.
By default, history is saved to \fI$(HOME)/.neo4j/client-history\fR.
.TP
.I \-\-no-history
Do not save the command history.
.TP
.I \-\-colorize
Enable colorization of output and errors using ANSI escape sequences.
.TP
.I \-\-no-colorize
Disable colorization of output and errors even when connected to a TTY.
.TP
.I \-\-ca\-file=cert.pem
Specify a file containing trusted certificates (and CRLs). The file should
contain one or more certificates in PEM format.
.TP
.I \-\-ca\-directory=dir
Specify a directory containing trusted certificates (and CRLs). The
certificates should have names of the form: hash.0 or have symbolic links to
them of this form ("hash" is the hashed certificate subject name: see the -hash
option of the x509 utility). Under Unix the c_rehash script will automatically
create symbolic links to a directory of certificates.
.TP
.I \-\-insecure
Do not attempt to establish a secure (TLS) connection to Neo4j.
.TP
.I \-\-non-interactive
Use non-interactive (batch) mode and do not prompt for credentials when
connecting.
.TP
.I \-\-username=name, \-u name
Use the specified username when connecting.
The username (and password) can also be supplied in the connection URL, and will
override what is set here.
.TP
.I \-\-password=pass, \-p pass
Use the specified password when connecting.
The password (and username) can also be supplied in the connection URL, and will
override what is set here.
.TP
.I \-P
Prompt for a password, even in non-interactive (batch) mode. This option
requires that neo4j-client is being run with a controlling TTY, which will
be used for password prompting and input.
.TP
.I \-\-known-hosts=file
When using secure (TLS) connections, the certificate signatures of previously
verified hosts is persisted to the known hosts file. This setting specifies
the location of that file.
By default, the file is \fI$(HOME)/.neo4j/neo4j_known_certs\fR.
.TP
.I \-\-no-known-hosts
Do not do host checking via known-hosts (use only TLS certificate verification).
.TP
.I \-\-output file, \-o file
Redirect output to the specified file. Must be specified in conjunction with
\fI--source\fR/\fI-i\fR, and may be specified multiple times.
.TP
.I \-\-source file, \-i file
Read input from the specified file. May be specified multiple times.
.TP
.I \-\-verbose, \-v
Increase the logging verbosity. Each use increases the verbosity. Each
verbosity level roughly equates to logging of warnings, general information,
debug output and trace information.
.TP
.I \-\-version
Print the neo4j\-client version and exit.
.SH URL
A URL may be specified on the command line, and will cause \fBneo4j\-client\fR
to attempt to connect to the specified server immediately. The URL is of the
form \fIneo4j://host[:port]\fR, and specifies the host and port the Neo4j
server is listening on.
.SH INTERACTIVE MODE
When \fBneo4j\-client\fR is started with standard input connected to an
interactive terminal, it will run in interactive mode. This will present a
command prompt to the user and will evaluate each command as it is entered. The
history of entered commands will be saved (unless disabled) and an errors in
evaluation will be presented to the user. Results from statements sent to Neo4j
will be presented to the user in table format (by default), using the full
width of the terminal.
.SH NON-INTERACTIVE (BATCH) MODE
When \fBneo4j\-client\fR is started with standard intput connected to a pipe,
or when the \fI--source\fR/\fI-i\fR argument is specified, statements will be
read from the pipe or the specified file(s). Any error in evaluation will
cause \fBneo4j\-client\fR to terminate without evaluating any further input.
By default, results will be output in CSV format, although this may be
changed using \fI:set format=(csv|table)\fR.
.SH USAGE
Once started, commands and statements can be entered at the \fBneo4j\-client\fR
prompt. Commands always begin with a colon (:) and conclude at the end of the
line, e.g. \fI:help\fR, and are evaluated by \fBneo4j\-client\fR rather than
being sent to the Neo4j server. Statements do not begin with a colon (:), may
span multiple lines, are terminated with a semi-colon (;) and will be sent to
the Neo4j server for evaluation.
.SH COMMANDS
\fBneo4j\-client\fR understands a variety of commands, including:
.TP
.I :help
List all the available commands and usage information.
.TP
.I ":quit \fR(or \fI:exit\fR)\fI"
Exit \fBneo4j\-client\fR.
.TP
.I ":connect '<url>'"
Connect to the Neo4j server specified by the URL. Note that the URL must be
given in quotes, as the \fI//\fR characters in the URL would otherwise
be considered as the start of a comment.
.TP
.I ":connect <host>[:<port>]"
Connect to the Neo4j server specified by the host and optional port.
.TP
.I :disconnect
Disconnect from the Neo4j server (if connected).
.TP
.I :export [name=val] ...
Export parameters for queries. The parameter will be available in queries
as \fI{name}\fR, and will be a string containing the text specified. Values
containing spaces must be quoted, e.g. \fI:export name="foo bar"\fR. Multiple
name and value pairs may be specified. If no name and value pairs are specified,
then the list of currently exported values will be displayed.
Note that all parameters are sent to the server for every query, so it is
best not to export large values without immediately using \fI:unexport\fR
after.
.TP
.I :unexport name ...
Remove a named parameter from those exported to queries.
.TP
.I :reset
Reset the session with the server, aborting any open transactions.
.TP
.I :set [option=value] ...
Set various shell options. If no option name and value paris are specified,
then the list of current options and their values will be displayed.
.TP
.I :source <file>
Read and evaluate commands and statements in the specified file. Evaluation
will stop if any error is encountered.
.TP
.I :status
Show the client connection status, which indicates if the client is
disconnected or connected to a server. If the latter, the connection URI is
output.
.TP
.I ":format (table|csv)"
Set the output format to either table or CSV.
Equivalent to `:set format=(table|csv)`.
.TP
.I ":width <n>"
Set the output width for table rendering. \fIn\fR is either an integer between
2 and 4095, or "auto". In interactive mode, the default is "auto",
which sets the output width to match the width of the terminal (or to 70
characters if the output is not a terminal).
Equivalent to `:set width=<n>`.
.SH EXAMPLES
Start \fBneo4j\-client\fR in interactive mode, and run a query:
$ neo4j-client -u neo4j localhost
Password: *****
neo4j> MATCH (n:Person) RETURN n.name, n.born LIMIT 4;
+-----------------------------+-----------------------------+
| n.name | n.born |
+-----------------------------+-----------------------------+
| Keanu Reeves | 1964 |
| Carrie-Anne Moss | 1967 |
| Laurence Fishburne | 1961 |
| Hugo Weaving | 1960 |
+-----------------------------+-----------------------------+
neo4j> :quit
$
Evaluate a query in non-interactive (batch) mode, saving the output to a csv
file:
$ echo "MATCH (n:Person) RETURN n.name, n.born LIMIT 4;" | \\
neo4j\-client -u neo4j -P localhost > result.csv
Password: *****
$
$ cat result.csv
"n.name","n.born"
"Keanu Reeves",1964
"Carrie-Anne Moss",1967
"Laurence Fishburne",1961
"Hugo Weaving",1960
$
Evaluate a source file, and save the output:
$ neo4j\-client -u neo4j -p pass -o result.csv -i query.cyp
$
$ cat query.cyp
MATCH (n:Person) RETURN n.name, n.born LIMIT 4;
$
$ cat result.csv
"n.name","n.born"
"Keanu Reeves",1964
"Carrie-Anne Moss",1967
"Laurence Fishburne",1961
"Hugo Weaving",1960
$
.SH ERRORS
In interactive mode, \fBneo4j\-client\fR attempts to exit cleanly (with
\fI$?\fR set to 0) when the session is terminated via the use of \fI:quit\fR,
\fI:exit\fR or \fIctrl-D\fR, and to use a non-zero exit code otherwise.
In non-interactive (batch) mode, \fBneo4j\-client\fR will exit cleanly if all
statements read from stdin evaluate successfully.
.SH VERSION
This man page is current for version @VERSION@ of neo4j\-client.
.SH COPYRIGHT
http://www.apache.org/licenses/LICENSE\-2.0
.SH AUTHORS
Chris Leishman (http://github.com/cleishm)