├── .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 |
9 |
10 |