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
4 changes: 2 additions & 2 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async-trait = "0.1"
bytes = "1"
chrono = { version = "0.4", default-features = false, features = ["clock", "serde"] }
clap = { version = "4.5", features = ["std", "string"] }
cli-engine = { features = ["pkce-auth"], version = "0.8.4" }
cli-engine = { features = ["pkce-auth"], version = "0.8.6" }
dirs = "6"
domains-client = { path = "domains-client" }
fancy-regex = "0.14"
Expand Down
6 changes: 3 additions & 3 deletions rust/src/dns/add.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `dns add` — append new DNS records to a domain without touching existing ones.

use cli_engine::{CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};
use cli_engine::{Alignment, CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};
use serde_json::{Value, json};

use crate::domain::make_client;
Expand Down Expand Up @@ -85,8 +85,8 @@ fn view_columns() -> Vec<TableColumn> {
TableColumn::new("domain", "Domain"),
TableColumn::new("type", "Type"),
TableColumn::new("name", "Name"),
TableColumn::new("created", "Created"),
TableColumn::new("failed", "Failed"),
TableColumn::new("created", "Created").align(Alignment::Right),
TableColumn::new("failed", "Failed").align(Alignment::Right),
TableColumn::new("results", "Results").nested(vec![
TableColumn::new("data", "Data"),
TableColumn::new("status", "Status"),
Expand Down
6 changes: 3 additions & 3 deletions rust/src/dns/delete.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `dns delete` — remove all records matching a type+name from a domain.

use cli_engine::{CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};
use cli_engine::{Alignment, CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};
use serde_json::{Value, json};

use crate::domain::{api_error, make_client};
Expand Down Expand Up @@ -135,8 +135,8 @@ fn view_columns() -> Vec<TableColumn> {
TableColumn::new("domain", "Domain"),
TableColumn::new("type", "Type"),
TableColumn::new("name", "Name"),
TableColumn::new("deleted", "Deleted"),
TableColumn::new("failed", "Failed"),
TableColumn::new("deleted", "Deleted").align(Alignment::Right),
TableColumn::new("failed", "Failed").align(Alignment::Right),
TableColumn::new("action", "Action"),
TableColumn::new("records", "Records").nested(vec![
TableColumn::new("recordId", "Record ID"),
Expand Down
8 changes: 4 additions & 4 deletions rust/src/dns/set/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `dns set` — replace every record for a type+name pair (destructive).

use cli_engine::{CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};
use cli_engine::{Alignment, CommandResult, CommandSpec, RuntimeCommandSpec, TableColumn, Tier};

use crate::domain::{api_error, make_client};
use crate::output_schema::output_schema;
Expand Down Expand Up @@ -49,9 +49,9 @@ fn view_columns() -> Vec<TableColumn> {
TableColumn::new("domain", "Domain"),
TableColumn::new("type", "Type"),
TableColumn::new("name", "Name"),
TableColumn::new("replaced", "Replaced"),
TableColumn::new("created", "Created"),
TableColumn::new("deleted", "Deleted"),
TableColumn::new("replaced", "Replaced").align(Alignment::Right),
TableColumn::new("created", "Created").align(Alignment::Right),
TableColumn::new("deleted", "Deleted").align(Alignment::Right),
TableColumn::new("action", "Action"),
TableColumn::new("plan", "Plan").nested(vec![
TableColumn::new("action", "Action"),
Expand Down
8 changes: 4 additions & 4 deletions rust/src/domain/available.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! `gddy domain available` — check whether a domain can be registered (v3).

use cli_engine::{
CommandResult, CommandSpec, NextActionParam, RuntimeCommandSpec, TableColumn, Tier,
Alignment, CommandResult, CommandSpec, NextActionParam, RuntimeCommandSpec, TableColumn, Tier,
};
use serde_json::json;

Expand Down Expand Up @@ -33,9 +33,9 @@ fn view_columns() -> Vec<TableColumn> {
TableColumn::new("currency", "Currency"),
TableColumn::new("terms", "Terms").nested(vec![
TableColumn::new("periodLabel", "Period"),
TableColumn::new("price", "Price"),
TableColumn::new("firstTermPrice", "First-Term Price"),
TableColumn::new("renewalPrice", "Renewal Price"),
TableColumn::new("price", "Price").align(Alignment::Right),
TableColumn::new("firstTermPrice", "First-Term Price").align(Alignment::Right),
TableColumn::new("renewalPrice", "Renewal Price").align(Alignment::Right),
]),
]
}
Expand Down
10 changes: 5 additions & 5 deletions rust/src/domain/quote.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! `gddy domain quote` — price a registration, lock a quote, cache it (v3).

use cli_engine::{
CliCoreError, CommandResult, CommandSpec, NextActionParam, Result, RuntimeCommandSpec,
TableColumn, Tier,
Alignment, CliCoreError, CommandResult, CommandSpec, NextActionParam, Result,
RuntimeCommandSpec, TableColumn, Tier,
};
use serde_json::json;

Expand Down Expand Up @@ -250,8 +250,8 @@ fn view_columns() -> Vec<TableColumn> {
vec![
TableColumn::new("domain", "Domain"),
TableColumn::new("available", "Available"),
TableColumn::new("price", "Price"),
TableColumn::new("renewalPrice", "Renewal Price"),
TableColumn::new("price", "Price").align(Alignment::Right),
TableColumn::new("renewalPrice", "Renewal Price").align(Alignment::Right),
TableColumn::new("currency", "Currency"),
TableColumn::new("periodLabel", "Period"),
TableColumn::new("quoteToken", "Quote Token").no_truncate(true),
Expand All @@ -260,7 +260,7 @@ fn view_columns() -> Vec<TableColumn> {
TableColumn::new("inventory", "Inventory"),
TableColumn::new("fees", "Fees").nested(vec![
TableColumn::new("type", "Type"),
TableColumn::new("amount", "Amount"),
TableColumn::new("amount", "Amount").align(Alignment::Right),
TableColumn::new("currency", "Currency"),
]),
TableColumn::new("agreements", "Agreements"),
Expand Down
21 changes: 20 additions & 1 deletion rust/src/domain/suggest.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! `gddy domain suggest` — suggest available domains for a query (v3).

use cli_engine::{CommandResult, CommandSpec, NextActionParam, RuntimeCommandSpec, Tier};
use cli_engine::{
Alignment, CommandResult, CommandSpec, NextActionParam, RuntimeCommandSpec, TableColumn, Tier,
};
use serde_json::json;

use domains_client::types;
Expand Down Expand Up @@ -32,6 +34,22 @@ fn nonzero(n: i64) -> Option<std::num::NonZeroU64> {
u64::try_from(n).ok().and_then(std::num::NonZeroU64::new)
}

/// `price1Year`/`price2Year` and their renewal counterparts are formatted
/// currency strings (see `format_money`), not JSON numbers, so cli-engine's
/// auto-alignment for no-view columns doesn't apply to them — they're
/// right-aligned explicitly here instead so decimal points line up across
/// rows of differently-priced suggestions.
fn view_columns() -> Vec<TableColumn> {
vec![
TableColumn::new("domain", "Domain"),
TableColumn::new("price1Year", "1yr Price").align(Alignment::Right),
TableColumn::new("renewalPrice1Year", "1yr Renewal").align(Alignment::Right),
TableColumn::new("price2Year", "2yr Price").align(Alignment::Right),
TableColumn::new("renewalPrice2Year", "2yr Renewal").align(Alignment::Right),
TableColumn::new("currency", "Currency"),
]
}

/// Build the JSON view of a single suggestion, flattening its 1- and 2-year
/// `TermPrice` entries into scalar price/renewal-price fields (v3 returns
/// indicative pricing as a `prices` array, which doesn't project into a table).
Expand Down Expand Up @@ -126,6 +144,7 @@ pub(super) fn command() -> RuntimeCommandSpec {
.with_tier(Tier::Read)
.with_default_fields("domain,price1Year,renewalPrice1Year,currency")
.with_output_schema::<DomainSuggestResult>()
.with_view(view_columns())
.with_scopes(&[DOMAINS_READ]),
|ctx, args: SuggestArgs| async move {
let query = args.query;
Expand Down
Loading