Self-made tool: quickly open a node environment playground

Source: Internet
Author: User

Demand

This is often the case when writing code that requires experimental ideas and a playground environment to play. If it's a front-end, you can open Chrome's console, but if it's node, it's a bit of a hassle. I want to open my directory to store the test code, create a new directory, create a JS file, open the editor to start writing code. This series of troublesome processes leads directly to the deterioration of my quality of life. It would be nice if we could automate the process. What I want is to hit a command at the terminal and then help me to do all of these things, and then the ready-made editor in front of me, directly to start tapping the code.

Scheme

With homemade tools: Upload modified files to a specific server experience, now I just need to write a bash script that helps me:

    1. Accept a name that I want to specify and create the appropriate playground directory.
    2. Open my favorite editor and create a JS file with the name I specify.
    3. Open the terminal in the newly created playground directory to run debugging.
mkdir $1"$1/$1.js" &&  open-a terminal/users/drakedan/ documents/workspace/nodeplayground/$1

Save the above code in the directory where I specifically store the gadget, named Playnode.sh.

If you don't have a directory dedicated to gadgets, you can create one and then open ~/.bash_profile with the editor and add a single line to the list:

Export Path=${path}:/users/drakedan/documents/workspace/nodeplayground/bin

Here all my gadgets are placed in the /users/drakedan/documents/workspace/nodeplayground/bin directory.

Summarize

Finally only need to restart the terminal, and then only use in the terminal knocking >playnode.sh myplay gadget will help me to create a myplay directory under the specified directory, and sublime Open Myplay.js, and also thoughtful for me to open a terminal located in the Myplay directory. I'm done, and my mother doesn't have to worry about my delaying cancer any more!

Reference: Homemade tools: Uploading modified files to a specified server

Open Terminal here in Mac Os Finder

Self-made tool: quickly open a node environment playground

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.