extract_lockfile_name

Function extract_lockfile_name 

Source
pub fn extract_lockfile_name(lockfile_path: &Path) -> Option<&str>
Expand description

Determines the ecosystem type from a lock file path.

This is a convenience function that extracts the filename and can be used in conjunction with EcosystemRegistry::get_for_lockfile().

§Arguments

  • lockfile_path - Path to the lock file

§Returns

  • Some(&str) - Lock file name
  • None - Path has no filename component

§Examples

use std::path::Path;
use deps_lsp::file_watcher::extract_lockfile_name;

let path = Path::new("/project/Cargo.lock");
assert_eq!(extract_lockfile_name(path), Some("Cargo.lock"));