Document --search option in readme and add version number option

This commit is contained in:
Hackerpilot 2014-09-22 13:55:33 -07:00
parent f9e93b096a
commit 9434629416
5 changed files with 105 additions and 24 deletions

View File

@ -31,8 +31,8 @@ issue.
* Display of documentation comments in function call tips
* *alias this*
* *auto* declarations (Mostly)
* *with* statements
* Not working:
* Automatic starting of the server by the client
* UFCS suggestions
* Autocompletion of declarations with template arguments (This will work to some extent, but it won't do things like replace T with int)
* Determining the type of an enum member when no base type is specified, but the first member has an initialaizer
@ -149,6 +149,36 @@ followed by the byte offset, followed by a newline character. For example:
/home/example/src/project/bar.d 3482
## Search for symbols by name
The "--search" or "-s" option causes the server to return location information
for all symbols with the given name in both the file being edited as well as
the server cache. The output format is one result per line, with the path, the
symbol type, and the byte offset of the symbol separated by tab characters.
### Example
Search the server's cache for symbols named "toImpl". (Using echo to give an EOF
in place of a file being edited.)
```echo | dcd-client --search toImpl``
```
/usr/include/dmd/phobos/std/conv.d f 48491
/usr/include/dmd/phobos/std/conv.d f 47527
/usr/include/dmd/phobos/std/conv.d f 47229
/usr/include/dmd/phobos/std/conv.d f 40358
/usr/include/dmd/phobos/std/conv.d f 38348
/usr/include/dmd/phobos/std/conv.d f 35619
/usr/include/dmd/phobos/std/conv.d f 32743
/usr/include/dmd/phobos/std/conv.d f 22486
/usr/include/dmd/phobos/std/conv.d f 16322
/usr/include/dmd/phobos/std/conv.d f 14829
/usr/include/dmd/phobos/std/conv.d f 14066
/usr/include/dmd/phobos/std/conv.d f 13058
/usr/include/dmd/phobos/std/conv.d f 12717
/usr/include/dmd/phobos/std/conv.d f 9494
```
#Server
The server must be running for the DCD client to provide autocomplete information.
In future versions the client may start the server if it is not running, but for

View File

@ -21,6 +21,7 @@ clean:
CLIENT_SRC = src/client.d\
src/messages.d\
src/stupidlog.d\
src/dcd_version.d\
msgpack-d/src/msgpack.d
DMD_CLIENT_FLAGS = -Imsgpack-d/src\
@ -57,6 +58,7 @@ SERVER_SRC = src/actypes.d\
src/server.d\
src/stupidlog.d\
src/string_interning.d\
src/dcd_version.d\
libdparse/src/std/d/ast.d\
libdparse/src/std/d/entities.d\
libdparse/src/std/d/lexer.d\

View File

@ -32,6 +32,7 @@ import std.string;
import msgpack;
import messages;
import stupidlog;
import dcd_version;
int main(string[] args)
{
@ -44,6 +45,7 @@ int main(string[] args)
bool symbolLocation;
bool doc;
bool query;
bool printVersion;
string search;
try
@ -51,7 +53,8 @@ int main(string[] args)
getopt(args, "cursorPos|c", &cursorPos, "I", &importPaths,
"port|p", &port, "help|h", &help, "shutdown", &shutdown,
"clearCache", &clearCache, "symbolLocation|l", &symbolLocation,
"doc|d", &doc, "query|q", &query, "search|s", &search);
"doc|d", &doc, "query|q", &query, "search|s", &search,
"version", &printVersion);
}
catch (Exception e)
{
@ -61,7 +64,13 @@ int main(string[] args)
AutocompleteRequest request;
if (help)
if (printVersion)
{
writeln(DCD_VERSION);
return 0;
}
else if (help)
{
printHelp(args[0]);
return 0;
@ -231,6 +240,9 @@ Options:
Instructs the server to add PATH to its list of paths searced for
imported modules.
--version
Prints the version number and then exits.
--port PORTNUMBER | -p PORTNUMBER
Uses PORTNUMBER to communicate with the server instead of the default
port 9166.`, programName);

21
src/dcd_version.d Normal file
View File

@ -0,0 +1,21 @@
/**
* This file is part of DCD, a development tool for the D programming language.
* Copyright (C) 2014 Brian Schott
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
module dcd_version;
enum DCD_VERSION = "v0.4.0-beta2";

View File

@ -40,6 +40,7 @@ import modulecache;
import stupidlog;
import actypes;
import core.memory;
import dcd_version;
enum CONFIG_FILE_NAME = "dcd.conf";
@ -58,11 +59,13 @@ int main(string[] args)
ushort port = 9166;
bool help;
bool printVersion;
string[] importPaths;
try
{
getopt(args, "port|p", &port, "I", &importPaths, "help|h", &help);
getopt(args, "port|p", &port, "I", &importPaths, "help|h", &help,
"version", & printVersion);
}
catch (ConvException e)
{
@ -71,6 +74,12 @@ int main(string[] args)
return 1;
}
if (printVersion)
{
writeln(DCD_VERSION);
return 0;
}
if (help)
{
printHelp(args[0]);
@ -277,8 +286,15 @@ void printHelp(string programName)
Usage: %s options
options:
-I path
Includes path in the listing of paths that are searched for file imports
-I PATH
Includes PATH in the listing of paths that are searched for file
imports.
--help | -h
Prints this help message.
--version
Prints the version number and then exits.
--port PORTNUMBER | -pPORTNUMBER
Listens on PORTNUMBER instead of the default port 9166.`, programName);