Skip to content

Commit

Permalink
Merge branch 'feature/ISSUE16-Clean-up-for-0.1.0'
Browse files Browse the repository at this point in the history
* feature/ISSUE16-Clean-up-for-0.1.0:
  - Added link to distribution tarball.
  - "source" -> "distribution".
  - Corrected formatting.
  - Added usage documentation.
  - Cleaned up speed table formatting.
  - Added speed comparison to README.md.
  - #if 0'ed out "File inclusion/exclusion:" options, since they're not implemented yet. - More work on README.md.
  - Improved README.md.
  • Loading branch information
gvansickle committed Oct 18, 2015
2 parents 5bbc044 + bea011e commit 8ae1f9f
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 3 deletions.
75 changes: 72 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,82 @@

UniversalCodeGrep (ucg) is another [Ack](http://beyondgrep.com/) clone. It is a grep-like tool specialized for searching large bodies of source code.

Ucg is written in C++ and takes advantage of the C++11 and newer facilities of the language to reduce reliance on non-standard libraries, increase portability, and increase scanning speed.
`ucg` is written in C++ and takes advantage of the C++11 and newer facilities of the language to reduce reliance on non-standard libraries, increase portability, and increase scanning speed.

As a consequence of `ucg`'s use of these facilities and its overall design for maximum concurrency and speed, `ucg` is extremely fast. Under Ubuntu 15.04, scanning the Boost 1.58.0 source tree with `ucg` 0.1.0, [`ag`](http://geoff.greer.fm/ag/) 0.28.0, and `ack` 2.14 produces the following results:

| Command | Approximate Real Time |
|---------|-----------------------|
| `time ucg '#endif' ~/src/boost_1_58_0` | ~ 3 seconds |
| `time ag '#endif' ~/src/boost_1_58_0` | ~ 10 seconds |
| `time ack '#endif' ~/src/boost_1_58_0` | ~ 19 seconds |

## License

[GPL (Version 3 only)](https://github.com/gvansickle/ucg/blob/master/COPYING)

## Installation

[@TODO - No releases yet.]
UniversalCodeGrep installs from the distribution tarball (available [here](https://github.com/gvansickle/ucg/releases/download/0.1.0/universalcodegrep-0.1.0.tar.gz)) in the standard autotools manner:

```sh
tar -xaf universalcodegrep-0.1.0.tar.gz
cd universalcodegrep-0.1.0.tar.gz
./configure
make
make install
```

This will install the `ucg` executable in `/usr/local/bin`. If you wish to install it elsewhere or don't have permissions on `/usr/local/bin`, specify an installation prefix on the `./configure` command line:

```sh
./configure --prefix=~/<install-root-dir>
```

### Prerequisites

- gcc version 4.9 or greater.
- `gcc` version 4.9 or greater.

Versions of `gcc` prior to 4.9 are known to ship with an incomplete implementation of the standard `<regex>` library. Since `ucg` depends on this C++11 feature, `configure` attempts to detect a broken `<regex>` at configure-time.

### Supported OSes and Distributions

UniversalCodeGrep should build and function anywhere there's a `gcc` 4.9 or greater available. It has been tested on the following OSes/distros:

- Linux
- Ubuntu 15.04 (with gcc 4.9.2, the current default compiler on this distro)
- Windows 7 + Cygwin 64-bit (with gcc 4.9.3, the current default compiler on this distro)

## Usage

Invoking `ucg` is the same as with `ack`:

```sh
ucg [OPTION...] PATTERN [FILES OR DIRECTORIES]
```

...where `PATTERN` is an ECMAScript-compatible regular expression.

If no `FILES OR DIRECTORIES` are specified, searching starts in the current directory.

### Options

Version 0.1.0 of `ucg` only supports a small subset of the options supported by `ack`. Future releases will have support for more options.

#### Searching

| Option | Description |
|----------------------|------------------------------------------|
| `-i, --ignore-case` | Ignore case distinctions in PATTERN |


#### File presentation

| Option | Description |
|----------------------|------------------------------------------|
| `--color, --colour` | Render the output with ANSI color codes. |
| `--nocolor, --nocolour` | Render the output without ANSI color codes. |

## Author

Gary R. Van Sickle
2 changes: 2 additions & 0 deletions src/ArgParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ static struct argp_option options[] = {
{"colour", OPT_COLOR, 0, OPTION_ALIAS },
{"nocolor", OPT_NOCOLOR, 0, 0, "Render the output without ANSI color codes."},
{"nocolour", OPT_NOCOLOR, 0, OPTION_ALIAS },
#if 0 /// @todo Put this back in, add the functionality.
{0,0,0,0, "File inclusion/exclusion:"},
{"ignore-dir", OPT_IGNORE_DIR, "REGEX", 0, "Exclude directories matching this regex pattern."},
{"noignore-dir", OPT_NOIGNORE_DIR, "REGEX", 0, "Do not exclude directories matching this regex pattern."},
#endif
{0,0,0,0, "Miscellaneous:" },
{"jobs", 'j', "NUM_JOBS", 0, "Number of scanner jobs (std::thread<>s) to use" },
{ 0 }
Expand Down

0 comments on commit 8ae1f9f

Please sign in to comment.