Skip to content

Commit

Permalink
Merge pull request #201 from nicklan/fix-missing-expires-crash
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklan authored Sep 20, 2022
2 parents fdc7f85 + 2b11b38 commit 42f9397
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/completer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ impl ClickHelper {
if let Some(ref env) = self.env {
match last_opt {
Some(opt) => {
let opts = cmd.try_completed_named(pos, opt, prefix, &*env);
let opts = cmd.try_completed_named(pos, opt, prefix, env);
(cmd_len, opts)
}
None => {
let opts = cmd.try_complete(pos, prefix, &*env);
let opts = cmd.try_complete(pos, prefix, env);
(cmd_len, opts)
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/config/click.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ use std::io::Read;

use crate::error::ClickError;

#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
pub struct Alias {
pub alias: String,
pub expanded: String,
}

#[derive(PartialEq, Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum EditMode {
Emacs,
Vi,
Expand Down Expand Up @@ -59,7 +59,7 @@ impl From<&EditMode> for String {
}
}

#[derive(PartialEq, Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, PartialEq, Eq, Serialize)]
pub enum CompletionType {
Circular,
List,
Expand Down
12 changes: 8 additions & 4 deletions src/config/kubefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,16 @@ impl AuthProviderConfig {
}
}

fn default_none() -> Option<SystemTime> {
None
}

#[serde_with::serde_as]
#[derive(PartialEq, Debug, Deserialize, Clone)]
struct AuthProviderAzureConfig {
#[serde(rename = "access-token")]
access_token: Option<String>,
#[serde(rename = "expires-on")]
#[serde(rename = "expires-on", default = "default_none")]
#[serde_as(as = "Option<TimestampSeconds<String,Flexible>>")]
expires_on: Option<SystemTime>,
}
Expand Down Expand Up @@ -438,15 +442,15 @@ impl AuthProviderGcpConfig {
}
}

#[derive(PartialEq, Debug, Deserialize, Clone)]
#[derive(Eq, PartialEq, Debug, Deserialize, Clone)]
pub struct NameValue {
name: String,
value: String,
}

/// config for running a command, as defined here:
/// https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/tools/clientcmd/api/v1/types.go#L183
#[derive(PartialEq, Debug, Deserialize, Clone)]
#[derive(Eq, PartialEq, Debug, Deserialize, Clone)]
pub struct ExecConfig {
command: Option<String>,
args: Option<Vec<String>>,
Expand Down Expand Up @@ -504,7 +508,7 @@ impl ExecConfig {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ExecAuth {
Token(String),
ClientCertKey { cert_data: String, key_data: String },
Expand Down
2 changes: 1 addition & 1 deletion src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct ExpandedAlias<'a> {
pub rest: &'a str,
}

#[derive(Debug, PartialEq)]
#[derive(Debug, Eq, PartialEq)]
pub enum ObjectSelection {
Single(KObj),
Range(Vec<KObj>),
Expand Down
4 changes: 2 additions & 2 deletions src/kobj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use serde_json::Value;

use std::io::Write;

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ObjType {
Pod {
containers: Vec<String>,
Expand All @@ -53,7 +53,7 @@ pub enum ObjType {
}

/// An object we can have as a "current" thing
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct KObj {
pub name: String,
pub namespace: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ pub fn raw_quantity(quantity: &Quantity) -> f64 {
}

// find location of first non-digit
let mut split = match chars.position(|c| !c.is_digit(10)) {
let mut split = match chars.position(|c| !c.is_ascii_digit()) {
Some(pos) => pos,
None => {
// no non digit, just parse as a raw number, set split to end of string
Expand Down

0 comments on commit 42f9397

Please sign in to comment.