Skip to content

A Rust library that provides `pushd`

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

houseabsolute/pushd

pushd

A simple library for temporarily changing the current working directory.

Usage

Add this to your Cargo.toml:

[dependencies]
pushd = "0.0.1"

Example

use anyhow::Result
use std::path::PathBuf;
use pushd::Pushd;

fn main() -> Result<()> {
    write_in_etc()?;
    // Current working directory is whatever it was before the call to
    // `write_in_etc`.
}

fn write_in_etc() -> Result<()> {
    let path = PathBuf::new("/etc");
    let _pd = Pushd::new(path)?;
    // Current working directory is now /etc
    //
    // Do something in /etc.
}

About

A Rust library that provides `pushd`

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Stars

Watchers

Forks

Packages

No packages published