├── .github └── FUNDING.yml ├── pet.png ├── Pipfile ├── setup.py ├── Pipfile.lock ├── advance_touch.py ├── .gitignore ├── README.md └── demo.svg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: tanrax 2 | ko_fi: androsfenollosa 3 | -------------------------------------------------------------------------------- /pet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanrax/terminal-AdvancedNewFile/HEAD/pet.png -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | verify_ssl = true 4 | name = "pypi" 5 | 6 | [packages] 7 | click = "*" 8 | 9 | [dev-packages] 10 | 11 | [requires] 12 | python_version = "3.6" 13 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | setup( 3 | name = 'advance-touch', 4 | py_modules=['advance_touch'], 5 | version = '1.0.2', 6 | python_requires='>3.6', 7 | description = 'Fast creation of files and directories. Mimics the operation of AdvancedNewFile (Vim plugin)', 8 | author = 'Andros Fenollosa', 9 | author_email = 'andros@fenollosa.email', 10 | url = 'https://github.com/tanrax/terminal-AdvancedNewFile', 11 | keywords = ['touch', 'mkdir', 'advance', 'vim'], 12 | classifiers=( 13 | "Programming Language :: Python :: 3", 14 | "License :: OSI Approved :: MIT License", 15 | "Operating System :: OS Independent", 16 | ), 17 | install_requires=[ 18 | 'Click>=6.7', 19 | ], 20 | entry_points=''' 21 | [console_scripts] 22 | ad=advance_touch:advance_touch 23 | ''' 24 | ) 25 | -------------------------------------------------------------------------------- /Pipfile.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_meta": { 3 | "hash": { 4 | "sha256": "09d3b72db87cd42a45d1d822d726c2a7c7682c8e1e405969f17ceda050b841fe" 5 | }, 6 | "pipfile-spec": 6, 7 | "requires": { 8 | "python_version": "3.6" 9 | }, 10 | "sources": [ 11 | { 12 | "name": "pypi", 13 | "url": "https://pypi.org/simple", 14 | "verify_ssl": true 15 | } 16 | ] 17 | }, 18 | "default": { 19 | "click": { 20 | "hashes": [ 21 | "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d", 22 | "sha256:f15516df478d5a56180fbf80e68f206010e6d160fc39fa508b65e035fd75130b" 23 | ], 24 | "index": "pypi", 25 | "version": "==6.7" 26 | } 27 | }, 28 | "develop": {} 29 | } 30 | -------------------------------------------------------------------------------- /advance_touch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # Libraries 5 | import os 6 | import click 7 | 8 | @click.command() 9 | @click.argument('paths', nargs=-1) 10 | @click.option('-cd/--change', is_flag=True, default=False, help='After creating the directories, change to the new deeper directory.') 11 | def advance_touch(paths, cd): 12 | """ Make folders and files """ 13 | for path in paths: 14 | # Make folders 15 | new_dirs = '/'.join(path.split('/')[0:-1]) 16 | if not os.path.exists(new_dirs) and new_dirs != '': 17 | os.makedirs(new_dirs) 18 | # Change directory 19 | if cd: 20 | cd_path = os.path.join(os.getcwd(), new_dirs) + '/' 21 | os.chdir(cd_path) 22 | 23 | # Make file 24 | if not path.endswith('/') and not os.path.isfile(path): 25 | try: 26 | open(path, 'w+').close() 27 | except IsADirectoryError: 28 | pass 29 | 30 | if __name__ == '__main__': 31 | advance_touch() 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

⚡ Advanced New File ⚡

4 |

5 | 6 | Add to your terminal the option to quickly create folders and files like a pro. 7 | 8 |

9 | 10 |

11 | 12 | [![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/) 13 | 14 | ## Use ⚙️ 15 | 16 | ```bash 17 | ad [path file or folder] 18 | ``` 19 | 20 | ## Install 🔌 21 | 22 | ``` bash 23 | pip3 install --user advance-touch 24 | ``` 25 | 26 | ## Update 💾 27 | 28 | ``` bash 29 | pip3 install --user --upgrade advance-touch 30 | ``` 31 | 32 | ## 📚 Examples 📚 33 | 34 | ### Single folder 📁 35 | 36 | ```bash 37 | ad airport/plane/ 38 | ``` 39 | 40 | ``` 41 | airport/ 42 | ├── plane/ 43 | ``` 44 | --- 45 | 46 | ### Multiple folders 📁➕📁➕📁 47 | 48 | ```bash 49 | ad airport/ station/ port/ 50 | ``` 51 | 52 | ``` 53 | airport/ 54 | station/ 55 | port/ 56 | ``` 57 | --- 58 | 59 | ### Single file with your hierarchy of folders 📁➡️📁➡️📝 60 | 61 | ```bash 62 | ad airport/plane/captain.txt 63 | ``` 64 | 65 | ``` 66 | airport/ 67 | ├── plane/ 68 | │ ├── captain.txt 69 | ``` 70 | 71 | --- 72 | 73 | ### Folder and single file with your hierarchy of folders 📁➕📁➡️📝 74 | 75 | ```bash 76 | ad airport/ train-station/train.txt 77 | ``` 78 | 79 | ``` 80 | airport/ 81 | ├── plane/ 82 | train-station/ 83 | ├── train.txt 84 | ``` 85 | --- 86 | 87 | ### If your shell supports arguments expansion 📁➡️📁➡️📝🤖 88 | 89 | ```bash 90 | ad airport/plane/{captain,passenger}.txt 91 | ``` 92 | 93 | ``` 94 | airport/ 95 | ├── plane/ 96 | │ ├── captain.txt 97 | │ ├── passenger.txt 98 | ``` 99 | --- 100 | 101 | Thanks to the power of 🐍 Python 🐍 102 | 103 | Pet created by [Freepik - Flaticon](https://www.flaticon.com/free-icons/folder) 104 | -------------------------------------------------------------------------------- /demo.svg: -------------------------------------------------------------------------------- 1 | 2 |                                                                                      ➜  Desktop                                                                           ➜  Desktop a                                                                         ➜  Desktop ad                                                                        ➜  Desktop ad                                                                        ➜  Desktop ad f                                                                      ➜  Desktop ad fi                                                                     ➜  Desktop ad fil                                                                    ➜  Desktop ad file                                                                   ➜  Desktop ad file.                                                                  ➜  Desktop ad file.t                                                                 ➜  Desktop ad file.tx                                                                ➜  Desktop ad file.txt                                                                ➜  Desktop t                                                                         ➜  Desktop tr                                                                        ➜  Desktop tre                                                                       ➜  Desktop tree                                                                      ➜  Desktop ad fo                                                                     ➜  Desktop ad fol                                                                    ➜  Desktop ad fold                                                                   ➜  Desktop ad folde                                                                  ➜  Desktop ad folder                                                                 ➜  Desktop ad folder/                                                                ➜  Desktop ad folder/a                                                               ➜  Desktop ad folder/an                                                              ➜  Desktop ad folder/and                                                             ➜  Desktop ad folder/and/                                                            ➜  Desktop ad folder/and/f                                                           ➜  Desktop ad folder/and/fi                                                          ➜  Desktop ad folder/and/fil                                                         ➜  Desktop ad folder/and/file                                                        ➜  Desktop ad folder/and/file.                                                       ➜  Desktop ad folder/and/file.t                                                      ➜  Desktop ad folder/and/file.tx                                                     ➜  Desktop ad folder/and/file.txt                                                      Desktop tree                                                                      ➜  Desktop ad m                                                                      ➜  Desktop ad mu                                                                     ➜  Desktop ad mul                                                                    ➜  Desktop ad mult                                                                   ➜  Desktop ad multi                                                                  ➜  Desktop ad multip                                                                 ➜  Desktop ad multipl                                                                ➜  Desktop ad multiple                                                               ➜  Desktop ad multiple/                                                              ➜  Desktop ad multiple/f                                                             ➜  Desktop ad multiple/fo                                                            ➜  Desktop ad multiple/fol                                                           ➜  Desktop ad multiple/fold                                                          ➜  Desktop ad multiple/folde                                                         ➜  Desktop ad multiple/folder                                                        ➜  Desktop ad multiple/folder.                                                       ➜  Desktop ad multiple/folder/                                                       ➜  Desktop ad multiple/folder/f                                                      ➜  Desktop ad multiple/folder/fi                                                     ➜  Desktop ad multiple/folder/fil                                                    ➜  Desktop ad multiple/folder/file                                                   ➜  Desktop ad multiple/folder/file.                                                  ➜  Desktop ad multiple/folder/file.t                                                 ➜  Desktop ad multiple/folder/file.tx                                                ➜  Desktop ad multiple/folder/file.txt                                               ➜  Desktop ad multiple/folder/file.txt                                               ➜  Desktop ad multiple/folder/file.txt s                                             ➜  Desktop ad multiple/folder/file.txt su                                            ➜  Desktop ad multiple/folder/file.txt sup                                           ➜  Desktop ad multiple/folder/file.txt supe                                          ➜  Desktop ad multiple/folder/file.txt super                                         ➜  Desktop ad multiple/folder/file.txt super/                                        ➜  Desktop ad multiple/folder/file.txt super/c                                       ➜  Desktop ad multiple/folder/file.txt super/co                                      ➜  Desktop ad multiple/folder/file.txt super/coo                                     ➜  Desktop ad multiple/folder/file.txt super/cool                                    ➜  Desktop ad multiple/folder/file.txt super/cool/                                   ➜  Desktop ad file.txt                                                               ➜  Desktop tree                                                                      .└── file.txt0 directories, 1 file➜  Desktop ad folder/and/file.txt                                                    ├── file.txt└── folder    └── and        └── file.txt2 directories, 2 files➜  Desktop ad multiple/folder/file.txt super/cool/                                   ├── folder│   └── and│       └── file.txt├── multiple│   └── folder└── super    └── cool6 directories, 3 files➜  Desktop                                                                            --------------------------------------------------------------------------------