Introduces the repository_path()
function on most subcommands, which allows them to propograte the repository path set with --repository <PATH>
. Eventually this should be integrated into a trait that all subcommands implement.
FIMDS32ZN6OCZUBWYNKDHZJ6FNKUC7NRUC37Q45HXQRBSTDM4YSQC
SXEYMYF7P4RZMZ46WPL4IZUTSQ2ATBWYZX7QNVMS3SGOYXYOHAGQC
L4JXJHWXYNCL4QGJXNKKTOKKTAXKKXBJUUY7HFZGEUZ5A2V5H34QC
Q45QHPO4HDTEZF2W4UDZSYYQ46BPEIWSW4GJILZR5HTJNLKXJABQC
ZHABNS3S6FSINO74FOI5KHYXYDTBPO4FQTTYTUS7NNKEVVNLYC4AC
3KRGVQFUWFHPOGZOXVTJYNCM4XBRVYITAEOVPKBSAZ5GZIUO5KVQC
QMTANHVNRPQ5IX66FYQBFRBDCTN6YKMNCO6OHTQ6QCUASPWWXJKAC
XA23FMQM2AI7RMR36AYN7UNP2D5JWVJMJPHURWZO7URM7H46PU6AC
LGEJSLTYI7Y2CYC3AN6ECMT3D3MTWCAKZPVQEG5MPM2OBW5FQ46AC
W5HHTRPKKM4D5CTW3CKQVPVQZUAYCL5HRC5JUDBAYRX5EZ7NWH2QC
LBVUI6AXIWB5RDRK5ECT6HQANLONXJVRHCTS54USSBXA2R4J6IWAC
QL6K2ZM35B3NIXEMMCJWUSFXOBQHAGXRDMO7ID5DCKTJH4QJVY7QC
EUZFFJSOWV4PXDFFPDAFBHFUUMOFEU6ST7JH57YYRRR2SEOXLN6QC
RUBBHYZ7MCLKJIHZ3EWEC3JR3FSKOU4T2NH7KRBG7ECAU4JF3LUAC
VGBH3ED6NZPQFNXHS4R3J2QIPN5WP4SUMCYQLBER3CV3AGCVHJJQC
IVLLXQ5ZWZDKHO4TNQG3TPXN34H6Y2WXPAGSO4PWCYNSKUZWOEJQC
OU6JOR3CDZTH2H3NTGMV3WDIAWPD3VEJI7JRY3VJ7LPDR3QOA52QC
6F6AAHK4M2IVS23TVISR5OJSTZXUSEKLOP5BMM7SUHYG2FQNTS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76T3QEVBB2VEZCY7ZD4EMRJ2BHKBTQC
OWO4EWK7YVHW544XJTTXAYO553GQKWGXIWNECDPWPFOGNJ6KHWAAC
let local_config = match Local::read_contents(&local_config_path) {
Ok(contents) => {
// Parse the config (and make sure it's valid!)
let local_config = Local::parse_contents(&local_config_path, &contents)?;
// Add the configuration layer as a string
layers = layers.merge(Toml::string(&contents));
let local_config = match repository_path {
Some(repository_path) => match Local::read_contents(&repository_path) {
Ok(contents) => {
// Parse the config (and make sure it's valid!)
let local_config = Local::parse_contents(&repository_path, &contents)?;
// Add the configuration layer as a string
layers = layers.merge(Toml::string(&contents));
Some(local_config)
}
Err(error) => {
warn!("Unable to read local config file: {error:#?}");
Some(local_config)
}
Err(error) => {
warn!("Unable to read global config file: {error:#?}");
None
}
},
None => {
info!(
"Skipping local configuration path - repository path was not supplied by caller"
);
let repository_path = std::env::current_dir()?;
let config = Config::load(&repository_path, opts.config)?;
let repository_path = match &opts.subcmd {
SubCommand::Log(log) => log.repository_path(),
SubCommand::Init(init) => init.repository_path(),
SubCommand::Clone(clone) => clone.repository_path(),
SubCommand::Record(record) => record.repository_path(),
SubCommand::Diff(diff) => diff.repository_path(),
SubCommand::Status(status) => status.repository_path(),
SubCommand::Push(push) => push.repository_path(),
SubCommand::Pull(pull) => pull.repository_path(),
SubCommand::Change(change) => change.repository_path(),
SubCommand::Dependents(deps) => deps.repository_path(),
SubCommand::Channel(channel) => channel.repository_path(),
SubCommand::Protocol(protocol) => protocol.repository_path(),
#[cfg(feature = "git")]
SubCommand::Git(git) => git.repository_path(),
SubCommand::Move(move_cmd) => move_cmd.repository_path(),
SubCommand::List(list) => list.repository_path(),
SubCommand::Add(add) => add.repository_path(),
SubCommand::Remove(remove) => remove.repository_path(),
SubCommand::Reset(reset) => reset.repository_path(),
SubCommand::Debug(debug) => debug.repository_path(),
SubCommand::Fork(fork) => fork.repository_path(),
SubCommand::Unrecord(unrecord) => unrecord.repository_path(),
SubCommand::Apply(apply) => apply.repository_path(),
SubCommand::Remote(remote) => remote.repository_path(),
SubCommand::Archive(archive) => archive.repository_path(),
SubCommand::Credit(credit) => credit.repository_path(),
SubCommand::Tag(tag) => tag.repository_path(),
SubCommand::Identity(identity) => identity.repository_path(),
SubCommand::Client(client) => client.repository_path(),
SubCommand::ExternalSubcommand(_) | SubCommand::Completion(_) => None,
};
let config = Config::load(repository_path, opts.config)?;