cargo-liner 0.10.1

Cargo subcommand to install and update binary packages listed in configuration.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
use std::collections::{BTreeMap, BTreeSet};
use std::fs;
use std::path::PathBuf;
use std::str::FromStr;

use color_eyre::Section;
use color_eyre::eyre::{self, Result, WrapErr, eyre};
use semver::{Op, Version, VersionReq};
use serde::Deserialize;
use serde_with::DeserializeFromStr;
use url::Url;

use super::{PackageRequirement, UserConfig};
use crate::cargo;

/// Representation of the `$CARGO_HOME/.crates.toml` Cargo-managed save file.
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize)]
pub struct CargoCratesToml {
    #[serde(rename = "v1")]
    pub package_bins: BTreeMap<CargoCratesPackage, Vec<String>>,
}

impl CargoCratesToml {
    /// The default name for the save file in Cargo's home.
    pub const FILE_NAME: &'static str = ".crates.toml";

    /// Returns the [`PathBuf`] pointing to the associated save file.
    ///
    /// In order to determine which exact file to get, it will first try to use
    /// `$CARGO_INSTALL_ROOT` if available, or then fall back to `$CARGO_HOME`
    /// otherwise.
    pub fn file_path() -> Result<PathBuf> {
        const INSTALL_ROOT_CONFIG_KEY: &str = "install.root";
        log::debug!("Building file path...");

        // Don't particularly filter: default to `$CARGO_HOME` on any error.
        match cargo::config_get(INSTALL_ROOT_CONFIG_KEY) {
            Ok(install_root_path) => Ok(install_root_path
                .parse::<PathBuf>()
                .wrap_err("Failed to parse the install.root Cargo config as a path.")
                .suggestion("Check in Cargo's config if the value is a well-formed path.")?
                .join(Self::FILE_NAME)),
            Err(err) => {
                log::debug!(
                    "Failed to retrieve `{INSTALL_ROOT_CONFIG_KEY}` from Cargo's configuration on error: {err:#?}.",
                );
                log::debug!("Defaulting to Cargo's home directory...");
                Ok(cargo::home()?.join(Self::FILE_NAME))
            }
        }
    }

    /// Parse and return a representation of the `$CARGO_HOME/.crates.toml`
    /// Cargo-managed save file.
    pub fn parse_file() -> Result<Self> {
        let path = Self::file_path().wrap_err("Failed to build Cargo's .crates.toml file path.")?;
        log::debug!("Reading Cargo-installed packages from {path:#?}...");
        let info_str = fs::read_to_string(path)
            .wrap_err("Failed to read Cargo's .crates.toml file.")
            .note("This can happen for many reasons.")
            .suggestion("Check if the file exists and has the correct permissions.")?;
        log::trace!("Read {} bytes.", info_str.len());
        log::trace!("Got: {info_str:#?}.");
        log::debug!("Deserializing packages...");
        let info = toml::from_str(&info_str)
            .wrap_err("Failed to deserialize Cargo's .crates.toml file contents.")
            .note("This should not easily happen as the file is automatically maintained by Cargo.")
            .suggestion("Check if it is corrupted in some way.")?;
        log::trace!("Got: {info:#?}.");
        Ok(info)
    }

    /// Consumes the document and returns the set of installed package names.
    pub fn into_names(self) -> BTreeSet<String> {
        self.package_bins.into_keys().map(|pkg| pkg.name).collect()
    }

    /// Consumes the document and returns the set of installed package names
    /// to versions.
    pub fn into_name_versions(self) -> BTreeMap<String, Version> {
        self.package_bins
            .into_keys()
            .map(|pkg| (pkg.name, pkg.version))
            .collect()
    }

    /// Converts this toml document into a custom user config by mapping
    /// listed packages using the given `pkg_map` function.
    ///
    /// The function must take in by value the couple of [`CargoCratesPackage`]
    /// to vector of binary names and return a couple of package name to
    /// [`PackageRequirement`] information.
    ///
    /// The current crate will be kept in the packages if `keep_self` is
    /// `true`, otherwise it will be filtered out.
    ///
    /// All locally-installed packages are kept if `keep_local` is
    /// `true`, otherwise they will be filtered out.
    fn into_config(
        self,
        pkg_map: impl FnMut((CargoCratesPackage, Vec<String>)) -> (String, PackageRequirement),
        keep_self: bool,
        keep_local: bool,
    ) -> UserConfig {
        UserConfig {
            packages: self
                .package_bins
                .into_iter()
                .filter(|(pkg, _)| {
                    (keep_local || pkg.source.kind != SourceKind::Path)
                        && (keep_self || pkg.name != clap::crate_name!())
                })
                .map(pkg_map)
                .collect(),
            defaults: None,
        }
    }

    /// Converts this toml document into a simple user config containing no
    /// particular version requirement, only stars are used.
    pub fn into_star_version_config(self, keep_self: bool, keep_local: bool) -> UserConfig {
        log::debug!("Converting packages to config with op: \"*\"...");
        self.into_config(
            |(pkg, _)| (pkg.name, PackageRequirement::SIMPLE_STAR),
            keep_self,
            keep_local,
        )
    }

    /// Converts the config by turning versions to requirements using the given
    /// comparison operator.
    ///
    /// Filters the current crate out of the resulting configuration's packages.
    fn into_op_version_config(self, op: Op, keep_self: bool, keep_local: bool) -> UserConfig {
        log::debug!("Converting packages to config with op: {op:#?}...");
        self.into_config(
            |(pkg, _)| {
                (
                    pkg.name,
                    PackageRequirement::Simple(ver_to_req(&pkg.version, op)),
                )
            },
            keep_self,
            keep_local,
        )
    }

    /// Converts this toml document into a simple user config containing full
    /// and exact version requirements.
    pub fn into_exact_version_config(self, keep_self: bool, keep_local: bool) -> UserConfig {
        self.into_op_version_config(Op::Exact, keep_self, keep_local)
    }

    /// Converts this toml document into a simple user config containing
    /// compatible version requirements, i.e. with the caret operator.
    pub fn into_comp_version_config(self, keep_self: bool, keep_local: bool) -> UserConfig {
        self.into_op_version_config(Op::Caret, keep_self, keep_local)
    }

    /// Converts this toml document into a simple user config containing
    /// patch version requirements, i.e. with the tilde operator.
    pub fn into_patch_version_config(self, keep_self: bool, keep_local: bool) -> UserConfig {
        self.into_op_version_config(Op::Tilde, keep_self, keep_local)
    }
}

/// Representation of keys of the `v1` table parsed by [`CargoCratesToml`].
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, DeserializeFromStr)]
pub struct CargoCratesPackage {
    pub name: String,
    pub version: Version,
    pub source: PackageSource,
}

/// Deserialize by splitting by spaces, isolating the name, parsing the version
/// and trimming the parentheses around the source.
impl FromStr for CargoCratesPackage {
    type Err = eyre::Error;

    fn from_str(s: &str) -> Result<Self> {
        let mut parts = s.splitn(3, ' ');
        let name = parts
            .next()
            .ok_or_else(|| eyre!("Missing name."))?
            .to_owned();

        Ok(Self {
            version: parts
                .next()
                .ok_or_else(|| eyre!("Missing version for {name:?}."))?
                .parse()
                .wrap_err_with(|| format!("Failed to parse the version for {name:?}."))?,
            source: parts
                .next()
                .ok_or_else(|| eyre!("Missing source for {name:?}."))?
                .trim_start_matches('(')
                .trim_end_matches(')')
                .parse()
                .wrap_err_with(|| format!("Failed to parse the source for {name:?}."))?,
            name,
        })
    }
}

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, DeserializeFromStr)]
pub struct PackageSource {
    pub kind: SourceKind,
    pub url: Url,
}

impl FromStr for PackageSource {
    type Err = eyre::Error;

    fn from_str(s: &str) -> Result<Self> {
        let mut parts = s.splitn(2, '+');
        Ok(Self {
            kind: parts
                .next()
                .ok_or_else(|| eyre!("Missing source origin."))?
                .parse()
                .wrap_err("Failed to parse the source kind.")?,
            url: parts
                .next()
                .ok_or_else(|| eyre!("Missing source path."))?
                .parse()
                .wrap_err("Failed to parse the source URL.")?,
        })
    }
}

#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, DeserializeFromStr)]
pub enum SourceKind {
    Git,
    Path,
    Registry,
    SparseRegistry,
}

impl FromStr for SourceKind {
    type Err = eyre::Error;

    fn from_str(s: &str) -> Result<Self> {
        Ok(match s {
            "git" => Self::Git,
            "path" => Self::Path,
            "registry" => Self::Registry,
            "sparse" => Self::SparseRegistry,
            kind => eyre::bail!("Unsupported source protocol: {}", kind),
        })
    }
}

/// Converts the given version to a version requirement with the given operator.
fn ver_to_req(ver: &Version, op: Op) -> VersionReq {
    let mut req = ver.to_string().parse::<VersionReq>().unwrap();
    req.comparators[0].op = op;
    req
}

#[cfg(test)]
mod tests {
    use std::iter;

    use super::*;

    impl PackageSource {
        fn crates_io() -> Self {
            Self {
                kind: SourceKind::Registry,
                url: "https://github.com/rust-lang/crates.io-index"
                    .parse()
                    .unwrap(),
            }
        }
    }

    #[test]
    fn test_deser_cargocrates_empty_iserr() {
        assert!(toml::from_str::<CargoCratesToml>("").is_err());
    }

    #[test]
    fn test_deser_cargocrates_no_packages() {
        assert_eq!(
            toml::from_str::<CargoCratesToml>("[v1]\n").unwrap(),
            CargoCratesToml {
                package_bins: BTreeMap::new(),
            },
        );
    }

    fn cargocrates_example1() -> CargoCratesToml {
        toml::from_str::<CargoCratesToml>(
            r#"
                [v1]
                "a 1.2.3 (registry+https://example.com/index)" = ["a"]
                "b 0.1.2 (registry+https://example.com/index)" = ["b1", "b2"]
                "c 0.0.0 (path+file:///a/b/c)" = ["c1", "c2", "c3"]
                "cargo-liner 0.2.1 (registry+https://crates.io/index)" = ["cargo-liner"]
            "#,
        )
        .unwrap()
    }

    #[test]
    fn test_deser_cargocrates_full_versions() {
        assert_eq!(
            cargocrates_example1(),
            CargoCratesToml {
                package_bins: [
                    (
                        "a",
                        "1.2.3",
                        "registry",
                        "https://example.com/index",
                        vec!["a"],
                    ),
                    (
                        "b",
                        "0.1.2",
                        "registry",
                        "https://example.com/index",
                        vec!["b1", "b2"],
                    ),
                    (
                        "c",
                        "0.0.0",
                        "path",
                        "file:///a/b/c",
                        vec!["c1", "c2", "c3"],
                    ),
                    (
                        "cargo-liner",
                        "0.2.1",
                        "registry",
                        "https://crates.io/index",
                        vec!["cargo-liner"],
                    ),
                ]
                .into_iter()
                .map(|(name, version, source_kind, source_url, bins)| (
                    CargoCratesPackage {
                        name: name.to_owned(),
                        version: version.parse::<Version>().unwrap(),
                        source: PackageSource {
                            kind: source_kind.parse().unwrap(),
                            url: source_url.parse().unwrap(),
                        },
                    },
                    bins.into_iter().map(str::to_owned).collect::<Vec<_>>(),
                ))
                .collect::<BTreeMap<_, _>>(),
            }
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_no_packages() {
        assert_eq!(
            CargoCratesToml::default().into_star_version_config(false, false),
            UserConfig::default(),
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_noself() {
        assert!(
            !CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_star_version_config(false, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_full_versions() {
        assert_eq!(
            cargocrates_example1().into_star_version_config(false, false),
            UserConfig {
                packages: [("a", "*"), ("b", "*")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intoexactcfg_noself() {
        assert!(
            !CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_exact_version_config(false, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intoexactcfg_full_versions() {
        assert_eq!(
            cargocrates_example1().into_exact_version_config(false, false),
            UserConfig {
                packages: [("a", "=1.2.3"), ("b", "=0.1.2")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intocompcfg_noself() {
        assert!(
            !CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_comp_version_config(false, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intocompcfg_full_versions() {
        assert_eq!(
            cargocrates_example1().into_comp_version_config(false, false),
            UserConfig {
                packages: [("a", "^1.2.3"), ("b", "^0.1.2")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intopatchcfg_noself() {
        assert!(
            !CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_patch_version_config(false, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intopatchcfg_full_versions() {
        assert_eq!(
            cargocrates_example1().into_patch_version_config(false, false),
            UserConfig {
                packages: [("a", "~1.2.3"), ("b", "~0.1.2")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_nopackages_keepself() {
        assert_eq!(
            CargoCratesToml::default().into_star_version_config(true, false),
            UserConfig::default(),
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_keepself() {
        assert!(
            CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_star_version_config(true, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_fullversions_keeplocal() {
        assert_eq!(
            cargocrates_example1().into_star_version_config(false, true),
            UserConfig {
                packages: [("a", "*"), ("b", "*"), ("c", "*")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_fullversions_keepself() {
        assert_eq!(
            cargocrates_example1().into_star_version_config(true, false),
            UserConfig {
                packages: [("a", "*"), ("b", "*"), (clap::crate_name!(), "*")]
                    .into_iter()
                    .map(|(name, version)| (
                        name.to_owned(),
                        PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                    ))
                    .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intostarcfg_fullversions_keepself_keeplocal() {
        assert_eq!(
            cargocrates_example1().into_star_version_config(true, true),
            UserConfig {
                packages: [
                    ("a", "*"),
                    ("b", "*"),
                    ("c", "*"),
                    (clap::crate_name!(), "*")
                ]
                .into_iter()
                .map(|(name, version)| (
                    name.to_owned(),
                    PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                ))
                .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intoexactcfg_keepself() {
        assert!(
            CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_exact_version_config(true, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intoexactcfg_fullversions_keepself() {
        assert_eq!(
            cargocrates_example1().into_exact_version_config(true, false),
            UserConfig {
                packages: [
                    ("a", "=1.2.3"),
                    ("b", "=0.1.2"),
                    (clap::crate_name!(), "=0.2.1")
                ]
                .into_iter()
                .map(|(name, version)| (
                    name.to_owned(),
                    PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                ))
                .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intocompcfg_keepself() {
        assert!(
            CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_comp_version_config(true, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intocompcfg_fullversions_keepself() {
        assert_eq!(
            cargocrates_example1().into_comp_version_config(true, false),
            UserConfig {
                packages: [
                    ("a", "^1.2.3"),
                    ("b", "^0.1.2"),
                    (clap::crate_name!(), "^0.2.1")
                ]
                .into_iter()
                .map(|(name, version)| (
                    name.to_owned(),
                    PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                ))
                .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }

    #[test]
    fn test_cargocrates_intopatchcfg_keepself() {
        assert!(
            CargoCratesToml {
                package_bins: iter::once((
                    CargoCratesPackage {
                        name: clap::crate_name!().to_owned(),
                        version: "1.2.3".parse().unwrap(),
                        source: PackageSource::crates_io(),
                    },
                    vec![],
                ))
                .collect()
            }
            .into_patch_version_config(true, false)
            .packages
            .contains_key(clap::crate_name!())
        );
    }

    #[test]
    fn test_cargocrates_intopatchcfg_fullversions_keepself() {
        assert_eq!(
            cargocrates_example1().into_patch_version_config(true, false),
            UserConfig {
                packages: [
                    ("a", "~1.2.3"),
                    ("b", "~0.1.2"),
                    (clap::crate_name!(), "~0.2.1")
                ]
                .into_iter()
                .map(|(name, version)| (
                    name.to_owned(),
                    PackageRequirement::Simple(VersionReq::parse(version).unwrap()),
                ))
                .collect::<BTreeMap<_, _>>(),
                defaults: None,
            },
        );
    }
}