Skip to content

Commit

Permalink
Merge pull request #831 from xliiv/2807-use-pager
Browse files Browse the repository at this point in the history
Add docs about pager in the pipeline command
  • Loading branch information
shcheklein authored Dec 11, 2019
2 parents f0091fe + 3441f79 commit 917be5a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
34 changes: 30 additions & 4 deletions static/docs/command-reference/pipeline/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ instead of stages.
option is specified) of stage outputs instead of paths to DVC-files.

- `--ascii` - visualize pipeline. It will print a graph (ASCII) instead of a
list of path to DVC-files. (To navigate, use arrows or `W`, `A`, `S`, `D`
keys. To exit, press `Q`.)
list of path to DVC-files. (`less` pager may be used, see
[Paging the output](#paging-the-output) below for details).

- `--dot` - show contents of `.dot` files with a DVC pipeline graph. It can be
passed to third party visualization utilities.
Expand All @@ -52,6 +52,33 @@ instead of stages.

- `-v`, `--verbose` - displays detailed tracing information.

## Paging the output

This command's output is automatically piped to
[Less](<https://en.wikipedia.org/wiki/Less_(Unix)>), if available in the
terminal. (The exact command used is `less --chop-long-lines --clear-screen`.)
If `less` is not available (e.g. on Windows), the output is simply printed out.

> It's also possible to
> [enable Less paging on Windows](/doc/user-guide/running-dvc-on-windows#enabling-paging-with-less).
### Providing a custom pager

It's possible to override the default pager via the `DVC_PAGER` environment
variable. For example, the following command will replace the default pager with
[`more`](<https://en.wikipedia.org/wiki/More_(command)>), for a single run:

```bash
$ DVC_PAGER=more dvc pipeline show --ascii my-pipeline.dvc
```

For a persistent change, define `DVC_PAGER` in the shell configuration. For
example in Bash, we could add the following line to `~/.bashrc`:

```bash
export DVC_PAGER=more
```

## Examples

Default mode: show stage files that `output.dvc` recursively depends on:
Expand All @@ -72,8 +99,7 @@ cleanup.py raw data
process.py data output
```

Visualize DVC pipeline (To navigate, use arrows or `W`, `A`, `S`, `D` keys. To
exit, press `Q`.):
Visualize DVC pipeline:

```dvc
$ dvc pipeline show eval.txt.dvc --ascii
Expand Down
15 changes: 15 additions & 0 deletions static/docs/user-guide/running-dvc-on-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ The performance of NTFS degrades while handling large volumes of files in a
directory.
[Here](https://stackoverflow.com/questions/197162/ntfs-performance-and-large-volumes-of-files-and-directories)
is the resource for reference.

## Enabling paging with `less`

By default, DVC tries to use [Less](<https://en.wikipedia.org/wiki/Less_(Unix)>)
as pager for the output of `dvc pipeline show`. Windows doesn't have the less
command available however. Fortunately, there is a easy way of installing `less`
via [Chocolatey](https://chocolatey.org/) (please install the tool first):

```dvc
$ choco install less
```

`less` can be installed in other ways, just make sure it's available in
`cmd`/Powershell, where you run dvc. (This usually means adding the directory
where `less` is installed to the `PATH` environment variable.)

0 comments on commit 917be5a

Please sign in to comment.