Git Product home page Git Product logo

squash's Introduction

Squash ๐ŸŽ‰

Build NPM Downloads Package Size NPM Version Contributors Commit Node Version

Squash

Let's squash your commands.

Squash allows you to give a custom name to your shell commands. These commands can be run using the custom name.

Give us a โญ if you like our work โค๏ธ

Install

$ npm i -g ak-squash

Setup

  • Export the squash path, to make the commands executable.

    export PATH=$PATH:/usr/local/.squash

    To make this export permanent read here

  • Now try running squash --help. This should display details on using squash

  • This completes your setup

Usage

Once you are done with the setup. You can start giving custom names to your commands.

You can find example usage of all the available features of squash here

Syntax for using squash is

squash {{COMMAND}} --alias={{NAME_FOR_COMMAND}}

  • COMMAND: The shell command which will be given a name
  • NAME_FOR_COMMAND: The custom name

Note: You can wrap the command between "COMMAND" if the command contains any types of quotes or spaces

Example

$ squash ls /home/squash --alias=list_squash

Now for using above created command just run

$ list_squash

Available Flags

Flags that require parameters

squash {{COMMAND}} --{{FLAG}}={{NAME_FOR_COMMAND}}
  • alias: to give name to a command
  • rm: removes a previously squashed command

Flags without parameters

squash --{{FLAG}}
  • help: gets help for squash
  • list: lists all the created commands
  • system-alias: lists all the system reserved aliases
  • pass-args: arguments called on the alias will be passed to the command. Use when creating the alias

Limitations

  • It does not work in Windows.
  • It does not support the cd command
  • Manually exporting the path /usr/local/.squash is very important.

Contributing

We are constantly working on improving squash and we need all the help we can get. You can contribute to this project by giving suggestions, fixing open issues or by implementing a new feature. Read our contibution guide here

squash's People

Contributors

aneal-sharma avatar arshadkazmi42 avatar biohazard2117 avatar consou avatar dependabot[bot] avatar fathurifki avatar jugalj05hi avatar konstunn avatar mzmmlds avatar raimeenakshi avatar romanegreen avatar samuelweekes avatar zandew avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

squash's Issues

Remove dummy squashed commands

While running tests, some dummy commands are generated and stored in the config.
Let's modify the tests to remove those dummy squashed commands once all tests are completed

Update contributors hof

Replace Contributors information in README with the below code

<a href="https://github.com/arshadkazmi42"><img src="https://github.com/arshadkazmi42.png" width="30" /></a><a href="https://github.com/ArthurCueio"><img src="https://github.com/ArthurCueio.png" width="30" /></a><a href="https://github.com/Zandew"><img src="https://github.com/Zandew.png" width="30" /></a><a href="https://github.com/co16353sidak"><img src="https://github.com/co16353sidak.png" width="30" /></a><a href="https://github.com/samuelweekes"><img src="https://github.com/samuelweekes.png" width="30" /></a><a href="https://github.com/alexmarginean16"><img src="https://github.com/alexmarginean16.png" width="30" /></a><a href="https://github.com/Aneal-Sharma"><img src="https://github.com/Aneal-Sharma.png" width="30" /></a><a href="https://github.com/konstunn"><img src="https://github.com/konstunn.png" width="30" /></a><a href="https://github.com/mzmmlds"><img src="https://github.com/mzmmlds.png" width="30" /></a><a href="https://github.com/fathurifki"><img src="https://github.com/fathurifki.png" width="30" /></a>

Change root dir for aliases

The current /usr/local/.squash folder requires root privileges. Forcing the user to run squash as root (sudo). Alternatively we could use:

  • ~/.local/bin
    or
  • ~/bin

Both of these won't need root permissions in order to create/delete files. Some side effects would be:

  • No need to manually export $PATH as both of the above paths are alredy exported by default.
  • The user wouldn't have to run squash as root. (Changes in #74 can be reverted after this)
  • Squashed commands would become user-wide instead of the current system-wide.

To change this all we need is change the following line:

ROOT_DIR: '/usr/local/.squash',

Change flags to sub commands

Change from flags to subcommands, right now complete squash works on flags.
We should change it into subcommands
squash --list
should be
squash list

This PR should be made against the 2.0 dev branch

Add option to delete alias

squash --list shows list of all created alias.
Let's add a feature to remove any existing alias by giving a rm flag

squash --r show-home

squash 2.0

There are some cool features that require a MAJOR update. I'll keep updating this list until we have enough to make a release.

  • #85 Change root dir to avoid manual export. (For this we need changes in the --list flag)
  • #95 Change from flags to subcommands? ( squash --list => squash list )
  • #94 Add terminal colors

I think it would be good to have a 2.0 development branch so we can start developing a better version and still push out fixes for 1.x

Unit testing

Add unit tests to test the library and also integrated TRAVIS.CI for continuous integration testing

Merge test files

Now all our tests are running by travis ci, there is no need to keep two separate test files.
Let's merge test/tests.js and test/local.js files

--pass-args flags is getting used as name

On using --pass-args flag while squashing commands, --pass-args is taken as name if we place it after the --alias flag.

squash ls --alias=list --pass-args

But if you use it like

squash ls --pass-args --alias-list

it works fine for this.

It should not matter by position of the flag to pick the filename. It should process everything based on the flags

Code restructuring

At present code is not structured properly.
Need to work on some cleanup and structuring the code properly.

Rewrite list command

We need a better way to keep track squashed commands. In order to change the root dir to a place we don't need to manually export (#85). The current version will try to list all files inside the squash directory.

This PR should be made against the 2.0 dev branch

Update PR template

Change PULL_REQUEST_TEMPLATE.md file content to below content

Fixes #issuenumber

Check everything which applies

- [ ] I have added the issue number for which this pull request is created.

Add PR Template

Add pull request template.
Create a file name PULL_REQUEST_TEMPLATE.md in root directory

and add the following in it

Fixes #issuenumber

Check everything which applies
[] I have added the issue number for which this pull request is created.

Add Contributors avatar

Add contributors avatar in README.md

Add the below code at the end of the README

## Contributors
[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/0)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/0)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/1)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/1)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/2)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/2)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/3)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/3)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/4)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/4)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/5)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/5)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/6)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/6)[![](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/images/7)](https://sourcerer.io/fame/arshadkazmi42/arshadkazmi42/squash/links/7)

Error removing squashed command

I'm trying to remove a squashed command, but it displays this error.
screenshot from 2019-02-13 22-00-03
Also should update readme to say --rm= instead of just --rm? had to look around for a while to find this.

Add minimun required node version badge

[![Node Version](https://img.shields.io/badge/node-v8.0%2B-brightgreen.svg)](https://github.com/arshadkazmi42/squash/)

Add it below title with other badges in readme

Remove all unsused dependencies

Somehow package.json has got alot of dependencies which are not even getting used.
package.json dependencies needs to be cleaned up

Add --version flag

Add --version flag, which should returns the version of installed version of squash

Creating an alias throws mkdir fault

Installing squash by following the given steps in the tutorial,
when I try to add an alias for a command it throws an error, linking the screenshot below.

screenshot 2019-02-14 at 2 33 15 pm

it tries to create a local/.squash file but finds it already there.
Is this error specific to my system or something which could be fixed.

OS: MacOS 10.14.3

Add a valid license

Right now squash is Unlicesnsed.
I think we should add MIT license to this.

index.js:6: SyntaxError: Unexpected token [

After installing with npm and running squash I have the following error

konstunn@asus:~ (master)$ squash
/usr/local/lib/node_modules/ak-squash/index.js:6
const [, , ...args] = process.argv;
      ^

SyntaxError: Unexpected token [
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3

Storing the sh details

Storing the sh details in some store, preferably a json.
It should be something like it can be accessed and edited later.

Store is open for discussion, we can use something else also other than json. We can discuss more on this if required

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.