@repokit/core 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.lock CHANGED
@@ -33,9 +33,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
33
33
 
34
34
  [[package]]
35
35
  name = "alphanumeric-sort"
36
- version = "1.5.5"
36
+ version = "1.5.6"
37
37
  source = "registry+https://github.com/rust-lang/crates.io-index"
38
- checksum = "774ffdfeac16e9b4d75e41225dc2545d9c2082a0634b5d7f6f70e168546eecb1"
38
+ checksum = "d7789d0c06f5a946e0d860f8a3cd055dd714d44657c16116cac8ee47da03f280"
39
39
 
40
40
  [[package]]
41
41
  name = "ansi-colors-macro"
@@ -593,9 +593,9 @@ dependencies = [
593
593
 
594
594
  [[package]]
595
595
  name = "jsonschema"
596
- version = "0.45.0"
596
+ version = "0.46.2"
597
597
  source = "registry+https://github.com/rust-lang/crates.io-index"
598
- checksum = "6f29616f6e19415398eb186964fb7cbbeef572c79bede3622a8277667924bbe3"
598
+ checksum = "50180452e7808015fe083eae3efcf1ec98b89b45dd8cc204f7b4a6b7b81ea675"
599
599
  dependencies = [
600
600
  "ahash",
601
601
  "bytecount",
@@ -666,6 +666,12 @@ version = "2.7.6"
666
666
  source = "registry+https://github.com/rust-lang/crates.io-index"
667
667
  checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
668
668
 
669
+ [[package]]
670
+ name = "micromap"
671
+ version = "0.3.0"
672
+ source = "registry+https://github.com/rust-lang/crates.io-index"
673
+ checksum = "c2a86d3146ed3995b5913c414f6664344b9617457320782e64f0bb44afd49d74"
674
+
669
675
  [[package]]
670
676
  name = "mio"
671
677
  version = "0.7.14"
@@ -944,14 +950,16 @@ dependencies = [
944
950
 
945
951
  [[package]]
946
952
  name = "referencing"
947
- version = "0.45.0"
953
+ version = "0.46.2"
948
954
  source = "registry+https://github.com/rust-lang/crates.io-index"
949
- checksum = "b8a618c14f8ba29d8193bb55e2bf13e4fb2b1115313ecb7ae94b43100c7ac7d5"
955
+ checksum = "acb0c66c7b78c1da928bee668b5cc638c678642ff587faff6e6222f797be9d4c"
950
956
  dependencies = [
951
957
  "ahash",
952
958
  "fluent-uri",
953
959
  "getrandom 0.3.4",
954
960
  "hashbrown",
961
+ "itoa",
962
+ "micromap",
955
963
  "parking_lot 0.12.5",
956
964
  "percent-encoding",
957
965
  "serde_json",
@@ -988,7 +996,7 @@ checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
988
996
 
989
997
  [[package]]
990
998
  name = "repokit"
991
- version = "4.0.1"
999
+ version = "4.0.3"
992
1000
  dependencies = [
993
1001
  "alphanumeric-sort",
994
1002
  "colored",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "repokit"
3
- version = "4.0.1"
3
+ version = "4.0.3"
4
4
  edition = "2024"
5
5
 
6
6
  [[bin]]
@@ -8,12 +8,12 @@ name = "repokit"
8
8
  path = "internals/main.rs"
9
9
 
10
10
  [dependencies]
11
- jsonschema = { version = "0.45.0", default-features = false }
11
+ jsonschema = { version = "0.46.2", default-features = false }
12
12
  serde = { version = "1.0", features = ["derive"] }
13
13
  serde_json = "1.0"
14
14
  colored = "3"
15
15
  normalize-path = "0.2.1"
16
- alphanumeric-sort = "1.5.5"
16
+ alphanumeric-sort = "1.5.6"
17
17
  ignore = "0.4.25"
18
18
  regex = { version = "1.12.3", features = ["std", "unicode"] }
19
19
  shellexpand = "3.1.2"
@@ -1,4 +1,4 @@
1
- CURRENT_VERSION="4.0.1"
1
+ CURRENT_VERSION="4.0.3"
2
2
  CWD=$(pwd)
3
3
 
4
4
  REPLACEMENT="/node_modules"
@@ -45,7 +45,7 @@ if [ -f "$OLD_CACHE_FILE" ]; then
45
45
  read -r OLD_SCHEMA_CACHED_VERSION
46
46
  read -r OLD_SCHEMA_CACHED_THEME
47
47
  } < "$OLD_CACHE_FILE"
48
- if [ ! -n "$ROOT_COMMIT" ] || [ -f "$REPO_CACHE_DIRECTORY/$SETTINGS_FILE" ]; then
48
+ if [ -n "$ROOT_COMMIT" ] && [ -f "$REPO_CACHE_DIRECTORY/$SETTINGS_FILE" ]; then
49
49
  OLD_SCHEMA_CACHED_THEME=""
50
50
  fi
51
51
  fi
@@ -61,8 +61,10 @@ if [ -n "$ROOT_COMMIT" ]; then
61
61
  mkdir "$ROOT_COMMIT"
62
62
  fi
63
63
  cd $ROOT_COMMIT;
64
- if [ -n "$OLD_SCHEMA_CACHED_THEME" ] && [ ! -f "$SETTINGS_FILE" ]; then
64
+ if [ ! -f "$SETTINGS_FILE" ]; then
65
65
  touch "$SETTINGS_FILE"
66
+ fi
67
+ if [ -n "$OLD_SCHEMA_CACHED_THEME" ]; then
66
68
  echo "$OLD_SCHEMA_CACHED_THEME\n" > "$SETTINGS_FILE"
67
69
  fi
68
70
  cd "../"
@@ -11,20 +11,22 @@ pub enum ArgvType {
11
11
  #[derive(Clone)]
12
12
  pub struct ArgvOption {
13
13
  pub value_type: ArgvType,
14
- pub short: Option<String>,
15
- pub name: String,
14
+ pub short: Option<&'static str>,
15
+ pub name: &'static str,
16
16
  pub multiple: Option<bool>,
17
17
  }
18
18
 
19
19
  pub struct Argv {
20
20
  pub values: HashMap<String, Vec<String>>,
21
+ pub positionals: Vec<String>,
21
22
  lookup_table: HashMap<String, ArgvOption>,
22
23
  }
23
24
 
24
25
  impl Argv {
25
- pub fn new(schema: Vec<ArgvOption>, args: Option<Vec<String>>) -> Argv {
26
+ pub fn new<const N: usize>(schema: [ArgvOption; N], args: Option<Vec<String>>) -> Argv {
26
27
  let mut argv = Argv {
27
28
  values: HashMap::new(),
29
+ positionals: Vec::new(),
28
30
  lookup_table: Argv::build_option_table(&schema),
29
31
  };
30
32
  argv.parse(args);
@@ -72,29 +74,26 @@ impl Argv {
72
74
  if self.lookup_table.contains_key(value) {
73
75
  break;
74
76
  }
75
- if values.len() == 1
76
- && (schema.multiple.is_none()
77
- || schema.multiple.is_some_and(|v| !v))
78
- {
79
- Logger::error(
80
- format!(
81
- "Recived more than one value for the option {}",
82
- Logger::with_theme(|theme| theme.highlight(&schema.name))
83
- )
84
- .as_str(),
85
- );
77
+ let values_for_argument = values.len();
78
+ if values_for_argument == 0 || schema.multiple.is_some_and(|v| v) {
79
+ values.push(value.to_string());
80
+ current += 1;
81
+ } else {
82
+ break;
86
83
  }
87
- values.push(value.to_string());
88
- current += 1;
89
84
  }
90
85
  }
91
86
  }
87
+ } else {
88
+ self.positionals.push(arg.to_owned());
92
89
  }
93
90
  pointer += 1;
94
91
  }
95
92
  }
96
93
 
97
- fn build_option_table(options: &Vec<ArgvOption>) -> HashMap<String, ArgvOption> {
94
+ fn build_option_table<const N: usize>(
95
+ options: &[ArgvOption; N],
96
+ ) -> HashMap<String, ArgvOption> {
98
97
  let mut table: HashMap<String, ArgvOption> = HashMap::new();
99
98
  for option in options {
100
99
  if option.name.len() < 2 {
@@ -106,7 +105,7 @@ impl Argv {
106
105
  .next()
107
106
  .expect("already checked for emptiness")
108
107
  .to_string();
109
- let short_flag = option.short.as_ref().unwrap_or(&first_char);
108
+ let short_flag = option.short.unwrap_or(&first_char);
110
109
  let flags = [format!("--{}", option.name), format!("-{}", short_flag)];
111
110
  for flag in flags {
112
111
  if table.contains_key(&flag) {
@@ -69,8 +69,8 @@ impl ListThemes {
69
69
  impl InternalExecutable for ListThemes {
70
70
  fn run(&self, args: Vec<String>, _: &HashMap<String, Box<dyn InternalExecutable>>) {
71
71
  let argv = Argv::new(
72
- vec![ArgvOption {
73
- name: "set".to_string(),
72
+ [ArgvOption {
73
+ name: "set",
74
74
  value_type: ArgvType::String,
75
75
  short: None,
76
76
  multiple: None,
@@ -18,11 +18,7 @@ impl ThemeColors {
18
18
  ThemeColors {
19
19
  prefixColor: input.prefixColor.unwrap_or(Color::BrightMagenta),
20
20
  commandColor: input.commandColor.unwrap_or(Color::BrightBlue),
21
- subcommandColor: input.subcommandColor.unwrap_or(Color::TrueColor {
22
- r: 175,
23
- g: 247,
24
- b: 7,
25
- }),
21
+ subcommandColor: input.subcommandColor.unwrap_or(Color::BrightCyan),
26
22
  argColor: input.argColor.unwrap_or(Color::Green),
27
23
  descriptionColor: input.descriptionColor.unwrap_or(Color::TrueColor {
28
24
  r: 128,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repokit/core",
3
- "version": "4.0.1",
3
+ "version": "4.0.3",
4
4
  "description": "A knowledgebase for your repository - wrapped in a CLI",
5
5
  "keywords": [
6
6
  "cli",
@@ -61,11 +61,11 @@
61
61
  "eslint": "^10.0.3",
62
62
  "eslint-import-resolver-typescript": "^4.4.4",
63
63
  "eslint-plugin-import": "^2.32.0",
64
- "eslint-plugin-simple-import-sort": "^12.1.1",
64
+ "eslint-plugin-simple-import-sort": "^13.0.0",
65
65
  "eslint-plugin-unused-imports": "^4.4.1",
66
- "oxfmt": "^0.43.0",
66
+ "oxfmt": "^0.47.0",
67
67
  "oxlint": "^1.42.0",
68
- "oxlint-tsgolint": "^0.19.0",
68
+ "oxlint-tsgolint": "^0.22.0",
69
69
  "tsdown": "^0.21.0",
70
70
  "tsx": "^4.21.0",
71
71
  "typescript": "^6.0.2"