CLI walkthrough
The core loop with the dvs binary
This walkthrough runs the everyday loop from the terminal: initialize a project, add a file, check its status, delete it, then get it back. It is the "I re-cloned a project and need its data" sequence. The R walkthrough covers the same steps from R.
🔗Setup
R creates the sandbox directories and the dataset; all dvs operations run via
the dvs binary.
options(width = 1000)
library(here)
storage <- basename(tempfile(fileext = "_storage"))
new_project <- basename(tempfile(fileext = "_project"))
dir.create(here::here(storage))
dir.create(here::here(new_project))
dir.create(here::here(new_project, "data"))
write.csv(Theoph, here::here(new_project, "data/theoph.csv"), row.names = FALSE)
Sys.setenv(DVS_PROJECT = here::here(new_project), DVS_STORAGE = here::here(storage))🔗1. Initialize
Point storage at the sibling directory. See dvs init for every flag.
cd "$DVS_PROJECT"
dvs init local "$DVS_STORAGE"DVS Initialized at /Users/elea/Documents/a2ai_github/dvs2-demo-repo/file5973c02d284_project🔗2. Add
Track the CSV with a message. See dvs add.
cd "$DVS_PROJECT"
dvs add data/theoph.csv -m "initial Theoph data"Added: data/theoph.csv [2.9 KB] --> saved [842 B] as cdd978e51298006701f7b285aaf979933f0af6b179bbdf3347014af3bcd48c06
Added 1🔗3. Status
The file is tracked and current. See dvs status.
cd "$DVS_PROJECT"
dvs status+-----------------+---------+--------+
| path | status | size |
+-----------------+---------+--------+
| data/theoph.csv | current | 2.9 KB |
+-----------------+---------+--------+
Checked 1🔗4. Remove the file
Delete the local copy, the moment after a fresh clone where the data is not on disk yet.
cd "$DVS_PROJECT"
rm data/theoph.csv🔗5. Status again
The file is now absent: tracked, but missing locally.
cd "$DVS_PROJECT"
dvs status+-----------------+--------+--------+
| path | status | size |
+-----------------+--------+--------+
| data/theoph.csv | absent | 2.9 KB |
+-----------------+--------+--------+
Checked 1
dvs reports five statuses: current, absent, stale (unchanged since dvs
wrote it, while the tracked version moved on), modified (edited locally) and
unsynced (different, with no record of what dvs wrote). See
dvs status and Storage and meta files.
🔗6. Get
Restore the file from storage. See dvs get.
cd "$DVS_PROJECT"
dvs get data/theoph.csvrestored data/theoph.csv 2.9 KB
Restored 1🔗7. Status again
The file is current again. The loop is complete.
cd "$DVS_PROJECT"
dvs status+-----------------+---------+--------+
| path | status | size |
+-----------------+---------+--------+
| data/theoph.csv | current | 2.9 KB |
+-----------------+---------+--------+
Checked 1🔗Cleanup
unlink(here::here(new_project), recursive = TRUE)
unlink(here::here(storage), recursive = TRUE)🔗Next steps
- The CLI reference covers every flag of dvs init, dvs add, dvs status, and dvs get.
- The same loop from R: R walkthrough.
- How dvs stores data: Storage and meta files.