Git Product home page Git Product logo

xonsh-autoxsh's Introduction

xonsh-autoxsh

Automatically execution of .autoxsh xonsh script after entering (cd-ing) into the directory.

PyPi version PyPi license PyPi license

Installation

pip install xonsh-autoxsh
# OR: pip install git+https://github.com/Granitas/xonsh-autoxsh
echo 'xontrib load autoxsh' >> ~/.xonshrc

Use cases

Run xonsh script after entering (cd-ing) into the directory

mkdir -p /tmp/dir
echo "print('it works!')" > /tmp/dir/.autoxsh
cd /tmp/dir
# Unauthorized ".autoxsh" file found in this directory. Authorize and invoke? (y/n/ignore): y
# it works!
cd /
cd /tmp/dir
# it works!

Activate Python virtual environment with vox

xontrib load vox
vox new myenv
mkdir -p /tmp/dir
echo "vox activate myenv" > /tmp/dir/.autoxsh
cd /tmp/dir
# Activated "myenv".

Links

xonsh-autoxsh's People

Contributors

anki-code avatar granitosaurus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xonsh-autoxsh's Issues

Add tags to repo

Hi! Thank you for the xontrib!

Please add xonsh and xontrib tags to the repo:

image

It helps spread the word about xontrib on Github.

Thanks!

Add checking md5 of .autoxsh file

Hi! Great xontrib!

To increase security:

  1. Save md5 hash and approval date of .autoxsh file with the path
  2. Check md5 hash before running
  3. If there is mismatch of hash then show prompt: with the time of change, the way to see the diff.

Example:

cd /project
# The autoxsh file in this directory was approved 2 months ago but was changed 5 days ago. 
# What's next? [Approve / Decline / Show diff / Skip autoxshing]

Thanks!

Add a leave dir option

Is it possible to implement auto command when leave dir too? Just asking for this implementation because for several venvs it would be very helpfull.

Don't clobber cd

Instead of overwriting the cd alias, save the old value and call it instead of xonsh.dirstack.cd().

This is to cooprerate better with xontrib-avox and xontrib-z (both of which also override cd).

Use xonsh data dir instead of home

Hi! Great xontrib!

_AUTHORIZED_FILE = os.path.expanduser('~/.autoxonsh_authorized')
_IGNORE_FILE = os.path.expanduser('~/.autoxonsh_ignore')

It will be good:

  1. To use the value from $XONSH_DATA_DIR (i.e. /home/user/.local/share/xonsh/, it's XDG_DATA_HOME) to saving data.
  2. Name the files as xontrib_autoxsh_ignore instead of .autoxonsh_ignore to make it visible and sane.

Thanks!

Creating Github releases

Hi!

Could you create Github releases for this? I'm using some automated tools to get latest release, update some JSON that's read by Nix expressions to generate my Xonsh dependencies and they fail when there's no release to use :)

Thanks! ๐Ÿ˜„

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.