Code Monkey home page Code Monkey logo

toggle's Introduction

Toggle

A small POSIX (mostly) tool that toggles the availability of one or more files in the filesystem. It operates by temporarily moving the disabled files to a storage area, from where they can be moved back to their original location by repeating the command.

Installing

Copy or symlink the main 'toggle' script to somewhere in PATH. Optionally copy or create configuration files.

Usage

Toggle will temporarily hide any file or set of files specified, and reveal them again by reissuing the command on the same path or set of paths. In addition, it is possible to specify grouped sets of automatic rules for path generation.

Rules are specified in config files, residing in the $XDG_CONFIG_HOME/toggle/ directory. See the example files for usage. Toggled files are stored in $XDG_DATA_HOME/toggle/repo, and a list of active toggles is kept in $XDG_DATA_HOME/toggle/active.

Active toggles (currently hidden files) can be listed using toggle -l.

toggle -h will provide more detailed information about flags and parameters.

Example

This session transcript uses the bundled githooks sample configuration.

~/dev/project/src$ toggle githooks
Disabled /home/dave/dev/project/.git/hooks/prepare-commit-msg
Disabled /home/dave/dev/project/.git/hooks/update

~/dev/project/src$ toggle -l
Currently disabled files:

/home/dave/dev/project/.git/hooks/prepare-commit-msg   (prepare-commit-msg)
/home/dave/dev/project/.git/hooks/update   (update)

~/dev/project/src$ toggle githooks update
Enabled /home/dave/dev/project/.git/hooks/update

toggle's People

Contributors

radiant64 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

toggle's Issues

'mv' will fail silently in some cases.

If the target file already exists and an overwrite fails/is not desired, the command will still return 0 and the file will be marked and logged as successfully enabled/disabled. Fixing this would probably(?) involve devising an atomic "fail-if-exists-else-move" operation.

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.