Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pin-project = "1"
pretty_assertions = "1"
proc-macro2 = "1"
quote = "1"
radix_trie = "0.3.0"
rand = "0.9"
ratatui = "0.29"
reflink-copy = "0.1"
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ libc = { workspace = true }
miette = { workspace = true }
num = { workspace = true }
owo-colors = { workspace = true }
petgraph = { workspace = true }
radix_trie = { workspace = true }
ratatui = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
Expand Down
14 changes: 8 additions & 6 deletions packages/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mod object;
mod outdated;
mod process;
mod progress;
mod publish;
mod pull;
mod push;
mod put;
Expand Down Expand Up @@ -220,6 +221,8 @@ enum Command {
#[command(alias = "ps")]
Processes(self::process::list::Args),

Publish(self::publish::Args),

Pull(self::pull::Args),

Push(self::push::Args),
Expand Down Expand Up @@ -1185,6 +1188,7 @@ impl Cli {
Command::Output(args) => self.command_process_output(args).boxed(),
Command::Process(args) => self.command_process(args).boxed(),
Command::Processes(args) => self.command_process_list(args).boxed(),
Command::Publish(args) => self.command_publish(args).boxed(),
Command::Pull(args) => self.command_pull(args).boxed(),
Command::Push(args) => self.command_push(args).boxed(),
Command::Put(args) => self.command_put(args).boxed(),
Expand Down Expand Up @@ -1399,12 +1403,10 @@ impl Cli {

let module = match referent.item.clone() {
tg::Object::Directory(directory) => {
let root_module_name = tg::package::try_get_root_module_file_name(
&handle,
Either::Left(&directory.clone().into()),
)
.await?
.ok_or_else(|| tg::error!("could not determine the executable"))?;
let root_module_name =
tg::package::try_get_root_module_file_name(&handle, Either::Left(&directory))
.await?
.ok_or_else(|| tg::error!("could not determine the executable"))?;
if let Some(path) = &mut referent.options.path {
*path = path.join(root_module_name);
} else {
Expand Down
38 changes: 24 additions & 14 deletions packages/cli/src/outdated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ pub struct Args {
impl Cli {
pub async fn command_outdated(&mut self, args: Args) -> tg::Result<()> {
let handle = self.handle().await?;
let object = self
.get_reference(&args.reference)
.await
.map_err(|source| tg::error!(!source, "failed to get reference"))?
.item()
.clone()
.right()
.ok_or_else(|| tg::error!(%reference = args.reference, "expected an object"))?;
let mut visitor = Visitor::default();
tg::object::visit(&handle, &mut visitor, [object])
let referent = self
.get_reference(&args.reference)
.await?
.try_map(|item| item.right().ok_or_else(|| tg::error!("expected an object")))?;
tg::object::visit(&handle, &mut visitor, &referent)
.await
.map_err(|source| tg::error!(!source, "failed to walk objects"))?;
let output = visitor.entries.into_iter().collect::<Vec<_>>();
Expand All @@ -45,11 +41,25 @@ impl<H> tg::object::Visitor<H> for Visitor
where
H: tg::Handle,
{
async fn visit_file(
async fn visit_directory(
&mut self,
_handle: &H,
_directory: tg::Referent<&tg::Directory>,
) -> tg::Result<bool> {
Ok(true)
}

async fn visit_symlink(
&mut self,
handle: &H,
file: &tangram_client::File,
) -> tangram_client::Result<()> {
_handle: &H,
_symlink: tg::Referent<&tg::Symlink>,
) -> tg::Result<bool> {
Ok(true)
}

async fn visit_file(&mut self, handle: &H, file: tg::Referent<&tg::File>) -> tg::Result<bool> {
let file = file.item;

// Get the file's dependencies.
let dependencies = file
.dependencies(handle)
Expand Down Expand Up @@ -104,6 +114,6 @@ where
self.entries.insert(entry);
}

Ok(())
Ok(true)
}
}
10 changes: 4 additions & 6 deletions packages/cli/src/process/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,10 @@ impl Cli {
},

tg::Object::Directory(directory) => {
let root_module_file_name = tg::package::try_get_root_module_file_name(
&handle,
Either::Left(&directory.clone().into()),
)
.await?
.ok_or_else(|| tg::error!("could not determine the executable"))?;
let root_module_file_name =
tg::package::try_get_root_module_file_name(&handle, Either::Left(&directory))
.await?
.ok_or_else(|| tg::error!("could not determine the executable"))?;
if let Some(path) = &mut referent.options.path {
*path = path.join(root_module_file_name);
} else {
Expand Down
Loading