-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from cjordan/failure->thiserror
failure -> thiserror/anyhow
- Loading branch information
Showing
32 changed files
with
785 additions
and
545 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
# `rubbl_casatables` | ||
|
||
A Rust interface to the CASA table format. | ||
|
||
See [the `rubbl_core` README on Crates.io][1] for a discussion of crate | ||
duplication issues that may arise with key dependencies such as [`ndarray`][2]. | ||
|
||
[1]: https://crates.io/crates/rubbl_core/ | ||
[2]: https://crates.io/crates/ndarray/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
// Copyright 2017 Peter Williams <[email protected]> and collaborators | ||
// Copyright 2017-2023 Peter Williams <[email protected]> and collaborators | ||
// Licensed under the MIT License. | ||
|
||
//! Summarize the structure of a CASA table. | ||
use anyhow::Error; | ||
use clap::{Arg, Command}; | ||
use rubbl_casatables::{Table, TableOpenMode}; | ||
use rubbl_core::{ctry, notify::ClapNotificationArgsExt, Error}; | ||
use rubbl_core::{ctry, notify::ClapNotificationArgsExt}; | ||
use std::{cmp::max, path::PathBuf, process}; | ||
|
||
fn main() { | ||
|
@@ -25,24 +26,30 @@ fn main() { | |
|matches, _nbe| -> Result<i32, Error> { | ||
let inpath = matches.get_one::<PathBuf>("IN-TABLE").unwrap(); | ||
|
||
let mut t = ctry!(Table::open(&inpath, TableOpenMode::Read); | ||
"failed to open input table \"{}\"", inpath.display()); | ||
let mut t = ctry!( | ||
Table::open(&inpath, TableOpenMode::Read); | ||
"failed to open input table \"{}\"", inpath.display() | ||
); | ||
|
||
println!("Table \"{}\":", inpath.display()); | ||
println!("Number of rows: {}", t.n_rows()); | ||
println!("Number of columns: {}", t.n_columns()); | ||
println!(""); | ||
|
||
let col_names = ctry!(t.column_names(); | ||
"failed to get names of columns in \"{}\"", inpath.display()); | ||
let col_names = ctry!( | ||
t.column_names(); | ||
"failed to get names of columns in \"{}\"", inpath.display() | ||
); | ||
|
||
let mut max_name_len = 0; | ||
let mut max_type_len = 0; | ||
let mut info: Vec<(&str, String, String)> = Vec::new(); | ||
|
||
for n in &col_names { | ||
let desc = ctry!(t.get_col_desc(&n); | ||
"failed to query column \"{}\" in \"{}\"", n, inpath.display()); | ||
let desc = ctry!( | ||
t.get_col_desc(&n); | ||
"failed to query column \"{}\" in \"{}\"", n, inpath.display() | ||
); | ||
|
||
let type_text = format!("{}", desc.data_type()); | ||
|
||
|
@@ -67,8 +74,10 @@ fn main() { | |
); | ||
} | ||
|
||
let table_kw_names = ctry!(t.table_keyword_names(); | ||
"failed to get keyword info in \"{}\"", inpath.display()); | ||
let table_kw_names = ctry!( | ||
t.table_keyword_names(); | ||
"failed to get keyword info in \"{}\"", inpath.display() | ||
); | ||
|
||
if table_kw_names.len() != 0 { | ||
println!(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.