Skip to content

Instantly share code, notes, and snippets.

@bantya
Created June 2, 2021 09:39
Show Gist options
  • Save bantya/afd5d8484ff2dd999ca0004e52502cf7 to your computer and use it in GitHub Desktop.
Save bantya/afd5d8484ff2dd999ca0004e52502cf7 to your computer and use it in GitHub Desktop.
Create Angular modules and components.
:: af utility to create Angular modules and components. (af = angular file)
::
:: syntax: af [m|c] <name> <c:module name>
::
:: e.g: > af m utils
:: = create module named utils
:: > af c search utils
:: = create a search component in utils module
::
:: author: github.com/bantya
:: date: 2021-06-02 02:27:08
@ECHO off
SET TYPE=%1
SET NAME=%2
SET MODULE=%3
IF %TYPE%==m (
MKDIR %NAME%
COPY /y NUL %NAME%\%NAME%.module.ts >NUL
ECHO SUCCESS: Created '%NAME%.module.ts'!
ECHO.
) ELSE (
IF %TYPE%==c (
FOR /f %%i IN ('cd') DO SET CURRENT=%%i
CD %MODULE%
MKDIR %NAME%
COPY /y NUL %NAME%\%NAME%.component.ts >NUL
COPY /y NUL %NAME%\%NAME%.component.html >NUL
COPY /y NUL %NAME%\%NAME%.component.css >NUL
ECHO ^<p^>%NAME% Component^</p^> > %NAME%\%NAME%.component.html
CD %CURRENT%
ECHO SUCCESS: Created '%NAME%\%NAME%.component.ts', '%NAME%\%NAME%.component.html', '%NAME%\%NAME%.component.css'!
ECHO.
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment