Code Monkey home page Code Monkey logo

shellexpand's Introduction

shellexpand, a library for shell-like expansion in strings

Build Status crates.io

Documentation

shellexpand is a single dependency library which allows one to perform shell-like expansions in strings, that is, to expand variables like $A or ${B} into their values inside some context and to expand ~ in the beginning of a string into the home directory (again, inside some context).

This crate provides generic functions which accept arbitrary contexts as well as default, system-based functions which perform expansions using the system-wide context (represented by functions from std::env module and dirs crate).

Usage

Just add a dependency in your Cargo.toml:

[dependencies]
shellexpand = "1.1.1"

See the crate documentation (a link is present in the beginning of this readme) for more information and examples.

Changelog

Version 2.0.0

  • Added support for default values in variable expansion (i.e. ${ANSWER:-42})
  • Breaking changes (minimum Rust version is now 1.30.0):
    • Using dyn for trait objects to fix deprecation warning
    • Switched to using source() instead of cause() in the Error implementation, and therefore added a 'static bound for the generic error parameter E

Version 1.1.1

  • Bump dirs dependency to 2.0.

Version 1.1.0

  • Changed use of deprecated std::env::home_dir to the dirs::home_dir function

Version 1.0.0

  • Fixed typos and minor incompletenesses in the documentation
  • Changed home_dir argument type for tilde expansion functions to FnOnce instead FnMut
  • Changed LookupError::name field name to var_name

Version 0.1.0

  • Initial release

License

This program is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

shellexpand's People

Contributors

netvl avatar nickhackman avatar lopopolo avatar roger avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.