Giter VIP home page Giter VIP logo

redh's Introduction

Redhand

pypi license

img1

Redhand (redh) is a command line tool for managing files and directories. This is my first project to build a command line tool, which is supposed to be more advanced in the next versions. I would greatly appreciate your participation on this project.

Table of Contents:

How to install

You can download and install this tool directly from pypi repository by pip module. (Make sure you are using Python3)

python3 -m pip install redh  

Quick look

Red Hand is a simple but useful tool for moving files and directories, which is very easy to work with. This tool also uses regex to filter contents.

You can ask anything you need to know from the --help option. Just write --help after each command to provide you with information about each command. You can also do this to get a general guide:

redh --help  

output:

Usage: redh [OPTIONS] COMMAND [ARGS]...

  Redhand is a command line tool for managing files and directories.

  To access the help of each command, use the --help option after
  writing the command.

  Github repo: https://github.com/mimseyedi/redh

Options:
  --version  Version of Redhand.
  --help     Show this message and exit.

Commands:
  drop   The Redhand leaves the files and directories it took in...
  grab   The Redhand takes the files and directories you specified.
  open   The contents of the hand will be displayed.
  org    Arranges and organizes the selected contents.
  scan   Search and check the desired files and directories.
  throw  It discards the contents of the hand by their index.
  wash   All contents in the hand are completely erased.  

Also, to find out about the Redhand version, you can do as follows:

redh --version  

output:

1.0.0  

Commands

The Redhand has very simple commands that you can easily learn how to use with the help of this guide.

scan

With the help of this command, you can find the files or directories you are looking for with the help of regex. Also, this command gives you a safe space to create regex patterns.

The scan command accepts only one argument from you, which must be between two single quotes and follow a regex expression.

redh scan 'txt$' 

output:

1 - f - /home/user/Desktop/homeworks.txt
2 - f - /home/user/Desktop/about.txt
3 - f - /home/user/Desktop/note.txt

The output shows us 3 things:

  • The index of each file or directory found.

  • Type the content found. f means file and d means directory.

  • The full address of the content found.

grab

With the help of this command, you can ask the Redhand to take files and directories for you and carry them anywhere you want. Of course, you should consider that he only remembers the addresses and copies them when moving. Therefore, if you take a content by hand and then delete it on the spot, the Redhand will not consider it anymore.

You can directly point to what you want one by one or group them with the help of regex.

Note: To use regex here, you must use two single quotes between two double quotes.

redh grab about.txt "'^Big+.+mkv$'" homeworks.txt

output:

'/home/user/Desktop/about.txt' successfully grabbed by hand!
'/home/user/Desktop/Big_bang_theory_S1_E1.mkv' successfully grabbed by hand!
'/home/user/Desktop/Big_bang_theory_S1_E2.mkv' successfully grabbed by hand!
'/home/user/Desktop/Big_bang_theory_S1_E3.mkv' successfully grabbed by hand!
'/home/user/Desktop/homeworks.txt' successfully grabbed by hand!

open

With this command, all the contents of the hand that have already been taken will be displayed.

The output shows us 3 things:

  • The index of each file or directory.

  • Type the content. f means file and d means directory.

  • The full address of the content.

Just enter the open command:

redh open

output:

1 - f - /home/user/Desktop/about.txt
2 - f - /home/user/Desktop/Big_bang_theory_S1_E1.mkv
3 - f - /home/user/Desktop/Big_bang_theory_S1_E2.mkv
4 - f - /home/user/Desktop/Big_bang_theory_S1_E3.mkv
5 - f - /home/user/Desktop/homeworks.txt

Also, the open command has an option called -f, which you can search among the contents with the help of regex:

redh open -f 'mkv$'

output

1 - f - /home/user/Desktop/Big_bang_theory_S1_E1.mkv
2 - f - /home/user/Desktop/Big_bang_theory_S1_E2.mkv
3 - f - /home/user/Desktop/Big_bang_theory_S1_E3.mkv

drop

With this command, you can copy the contents of the Redhand to the place you choose.

Using the -a option, you can copy all the contents:

redh drop -a

output:

'/home/user/Desktop/about.txt' was copied successfully!
'/home/user/Desktop/Big_bang_theory_S1_E1.mkv' was copied successfully!
'/home/user/Desktop/Big_bang_theory_S1_E2.mkv' was copied successfully!
'/home/user/Desktop/Big_bang_theory_S1_E3.mkv' was copied successfully!
'/home/user/Desktop/homeworks.txt' was copied successfully!

Or you can directly copy them by referring to the content index:

redh drop 1 5

output:

'about.txt' was copied successfully!
'homeworks.txt' was copied successfully!

throw

With this command, you can delete files or directories from the red hand by referring to the content index.

redh throw 2 3 4

output:

'/home/user/Desktop/Big_bang_theory_S1_E1.mkv' was successfully thrown away!
'/home/user/Desktop/Big_bang_theory_S1_E2.mkv' was successfully thrown away!
'/home/user/Desktop/Big_bang_theory_S1_E3.mkv' was successfully thrown away!

And then:

redh open

output:

1 - f - /home/user/Desktop/about.txt
2 - f - /home/user/Desktop/homeworks.txt

wash

With this command, all contents inside the red hand will be deleted.

redh wash

output:

The Hand washed successfully!

And then:

redh open

output:

The Hand is empty!

org

With this command, you can transfer the desired contents that you specified with the help of regex to the directory you want:

redh org 'py$' Python

This command means to move all Python files to a directory called Python. If a directory with this name already exists, the files will be moved there, and if not, a directory with this name will be created.

Contribute

I welcome your ideas to develop this tool. The options that I thought about for the next version include:

  • An option for the grab command to make a real copy of a file or directory to preserve if it is deleted.

  • Add an option for the drop command to use cut instead of copy.

  • Adding filtering with the help of regex to the drop and throw commands.

  • Add a log system to record and review all activities performed.

  • And ...

Resources

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.