Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dvc root command reference motivation and examples #1637

Merged
merged 19 commits into from
Jul 31, 2020
Merged
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8260191
Clarifies motivation and description, adds relevant examples
jeremydesroches Jul 29, 2020
ec65309
Returned to single paragraph, adjusts style to comments
jeremydesroches Jul 30, 2020
844f281
Returned to single paragraph, adjusts style to comments
jeremydesroches Jul 30, 2020
cae263c
Merge branch 'cmdroot' of https://github.com/jeremydesroches/dvc.org …
jeremydesroches Jul 30, 2020
3fa33d5
Fixes my merge mistake
jeremydesroches Jul 30, 2020
7a630b5
Removes repeated references to dvc root from examples
jeremydesroches Jul 30, 2020
f0ef6e8
Adds "root directory" to short intro
jeremydesroches Jul 30, 2020
8952e4e
Adds command name and splits description to two paragraphs
jeremydesroches Jul 30, 2020
8bd6c61
removes extra spacing from examples
jeremydesroches Jul 30, 2020
6dc5f64
Update content/docs/command-reference/root.md
jorgeorpinel Jul 30, 2020
24d5ed8
Update content/docs/command-reference/root.md
jorgeorpinel Jul 30, 2020
8474156
Update content/docs/command-reference/root.md
jeremydesroches Jul 31, 2020
9c82fc8
Removes extra examples, updates example titles and descriptions
jeremydesroches Jul 31, 2020
b05473b
Updates description to expand scripting use case
jeremydesroches Jul 31, 2020
f005507
Update content/docs/command-reference/root.md
jorgeorpinel Jul 31, 2020
f8b08e6
Update content/docs/command-reference/root.md
jorgeorpinel Jul 31, 2020
a7d0f27
Update content/docs/command-reference/root.md
jorgeorpinel Jul 31, 2020
070cf40
Update content/docs/command-reference/root.md
jorgeorpinel Jul 31, 2020
9496822
Update content/docs/command-reference/root.md
jorgeorpinel Jul 31, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions content/docs/command-reference/root.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# root

Return the relative path to the root of the <abbr>DVC project</abbr>.
Return the relative path to the root directory of the <abbr>DVC project</abbr>.

## Synopsis

Expand All @@ -10,11 +10,13 @@ usage: dvc root [-h] [-q | -v]

## Description

This command returns the path to the root directory of the <abbr>DVC
project</abbr>, relative to the current working directory. It can be used to
build a path to a dependency, script, or <abbr>data artifact</abbr>, for
example. Useful when working in a subdirectory of the project, and needing to
refer to a file in another directory.
Returns the path to the root directory of the <abbr>DVC project</abbr>, relative
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
to the current working directory. `dvc root` is useful for referencing a file in
another directory when working in a subdirectory of the project.

Use this command to build fixed paths to dependencies, files, or <abbr>data
artifacts</abbr>. Useful when creating shell scripts that generate `dvc.yaml`
files programmatically or with the `dvc run` helper.
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

## Options

Expand All @@ -29,22 +31,41 @@ refer to a file in another directory.

```dvc
$ dvc root

.

$ mkdir subdir
$ cd subdir
$ dvc root

..
```

## Example: Referencing files
## Example: Referencing fixed paths in other commands

When working in a subdirectory of a <abbr>DVC project</abbr>, simplify file
references by making all paths relative to the root directory.

```dvc
$ dvc root

../../../

$ dvc run -d $(dvc root)/data/file.cvs ... \
python $(dvc root)/scripts/something.py
```

## Example: Referencing fixed paths for other commands

When working in a subdirectory of a <abbr>DVC project</abbr>, simplify file
references in other commands by using paths relative to the root directory.
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved

```dvc
$ dvc root
../..

$ tree $(dvc root)/data/
../../data/
├── data.xml
├── data.xml.dvc
...
└── prepared
├── test.tsv
└── train.tsv
jorgeorpinel marked this conversation as resolved.
Show resolved Hide resolved
```