feat: infer current working directory

This commit is contained in:
D. Moonfire 2024-03-09 22:59:08 -06:00
parent c9f5f7d3ea
commit 30341b45ff

View file

@ -9,6 +9,7 @@ use semver::Version;
use semver_bump_trait::SemverBump;
use slog::{debug, info};
use std::cmp::Ordering;
use std::path::PathBuf;
use std::str::FromStr;
use crate::tags::get_tag_map;
@ -28,8 +29,11 @@ pub struct VersionCommand {
impl VersionCommand {
pub async fn run(&self, log: slog::Logger) -> Result<()> {
// Figure out the path we're searching and which one we found.
let current_dir = &self.directory.clone();
let current_dir = current_dir.as_ref().unwrap();
let current_dir = match &self.directory {
Some(current_dir) => PathBuf::from(current_dir.to_owned()),
None => std::env::current_dir()?,
};
info!(log, "searching from {:?}", current_dir);
// Load the repository so we can walk through it.