Skip to content

Commit 6f9dcb6

Browse files
authored
Merge pull request databricks#196 from nicklan/migrate-to-crossterm-colors-and-abstract
2 parents 4506c09 + e5cb6dd commit 6f9dcb6

36 files changed

+290
-139
lines changed

Cargo.lock

Lines changed: 13 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ travis-ci = { repository = "databricks/click" }
1818
argorollouts = [] # enable the `rollouts` command to view argo rollouts
1919

2020
[dependencies]
21-
ansi_term = "^0.12"
2221
atomicwrites = "^0.3"
2322
base64 = "^0.13"
2423
bytes = "1.0.1"
2524
chrono = { version = "^0.4", features = ["serde"] }
2625
clap = { version = "^3.1", features = ["cargo", "color"] }
2726
comfy-table = "^5.0"
27+
crossterm = "^0.23"
2828
ctrlc = "^3.1"
2929
dirs = "^4.0"
3030
duct = "^0.13"
@@ -50,3 +50,4 @@ tempdir = "^0.3"
5050
tokio = { version = "1", features = ["full"] }
5151
url = "^2.2"
5252
yasna = "^0.5"
53+
derivative = "2.2.0"

src/command/alias.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716
use rustyline::completion::Pair as RustlinePair;
1817

src/command/click.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use chrono::offset::Utc;
1716
use clap::{Arg, Command as ClapCommand};
1817
use comfy_table::Table;
@@ -57,14 +56,14 @@ fn print_contexts(env: &Env, writer: &mut ClickWriter) {
5756
};
5857
row.push(CellSpec::with_colors(
5958
(*context).clone().into(),
60-
Some(comfy_table::Color::Red),
59+
Some(env.styles.context_table_color().into()),
6160
None,
6261
));
6362
row.push(cluster.into());
6463
row
6564
})
6665
.collect();
67-
crate::table::print_table(vec!["Context", "Api Server Address"], ctxs, writer);
66+
crate::table::print_table(vec!["Context", "Api Server Address"], ctxs, env, writer);
6867
}
6968

7069
command!(

src/command/command_def.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,10 @@ macro_rules! command {
219219

220220
impl $cmd_name {
221221
pub fn new() -> $cmd_name {
222+
use crossterm::style::Stylize;
222223
lazy_static! {
223224
static ref ALIASES_STR: String =
224-
format!("{}:\n {:?}", Yellow.paint("ALIASES"), $aliases);
225+
format!("{}:\n {:?}", "ALIASES".yellow(), $aliases);
225226
}
226227
let clap = start_clap($name, $about, &ALIASES_STR, $trailing_var_arg);
227228
let extra = $extra_args(clap);

src/command/configmaps.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716
use k8s_openapi::api::core::v1 as api;
1817

src/command/copy.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716
use rustyline::completion::Pair as RustlinePair;
1817

src/command/crds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716

1817
use rustyline::completion::Pair as RustlinePair;
@@ -106,6 +105,7 @@ command!(
106105
match env.run_on_context::<_, GetTableResponse>(|c| c.read(request))? {
107106
GetTableResponse::Ok(resp) => {
108107
let kobjs = resp.print_to(
108+
env,
109109
env.namespace.is_none(),
110110
&desc.name,
111111
&desc.group_version,

src/command/daemonsets.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716
use k8s_openapi::api::apps::v1 as apps_api;
1817

src/command/delete.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ansi_term::Colour::Yellow;
1615
use clap::{Arg, Command as ClapCommand};
1716
use k8s_openapi::{
1817
api::apps::v1 as api_apps, api::batch::v1 as api_batch, api::core::v1 as api,

0 commit comments

Comments
 (0)