Clean up status output, such as it is; add to example.sh

This commit is contained in:
Josh Hansen 2023-09-26 22:22:50 -07:00
parent 7a95a15e4f
commit 91296166a5
3 changed files with 21 additions and 7 deletions

View file

@ -65,4 +65,9 @@ $GHEE create -v ./direct -k blah
# Create people2 in one go using `create'
$GHEE create -v ./people2 -k id < ../people.json
$GHEE status ./people2
mkdir ./empty
$GHEE status ./empty
cd ..

View file

@ -66,4 +66,12 @@ Initialized table ./people2 with key: user.id
Initialized ./people2/3
Initialized ./people2/4
Initialized ./people2/5
+ cargo run --quiet -- status ./people2
+./people2
+./people2/3
+./people2/4
+./people2/5
+ mkdir ./empty
+ cargo run --quiet -- status ./empty
No table found
+ cd ..

View file

@ -1,11 +1,13 @@
use std::{env::current_dir, path::PathBuf};
use std::path::PathBuf;
use anyhow::{Context, Result};
use path_absolutize::Absolutize;
use crate::{
containing_table_info, paths::table_snapshot_path, walk::walk_paths, xattr_value,
XATTR_MOST_RECENT_SNAPSHOT,
containing_table_info,
paths::{table_snapshot_path, PathBufExt},
walk::walk_paths,
xattr_value, XATTR_MOST_RECENT_SNAPSHOT,
};
/**
@ -14,11 +16,8 @@ use crate::{
pub fn status(path: &PathBuf, sort: bool) -> Result<()> {
let path = path.absolutize().unwrap().to_path_buf();
println!("status of {}", path.display());
println!("curdir: {}", current_dir().unwrap().display());
if let Some(table_info) = containing_table_info(&path)? {
let table_path = table_info.path_abs();
println!("table_path: {}", table_path.display());
// Empty list of predicate clauses to hand out
let where_ = Vec::new();
@ -37,7 +36,9 @@ pub fn status(path: &PathBuf, sort: bool) -> Result<()> {
for entry in working_it {
let entry = entry?;
println!("+{}", entry.path().display());
let entry_path = entry.path().to_path_buf();
let entry_display = entry_path.relative_to_curdir_if_possible();
println!("+{}", entry_display.display());
}
}
} else {