Skip to content

PR from Fecony's contribution to ask for removing files#617

Merged
davidverdu merged 25 commits intomainfrom
contrib
Feb 19, 2021
Merged

PR from Fecony's contribution to ask for removing files#617
davidverdu merged 25 commits intomainfrom
contrib

Conversation

@davidverdu
Copy link
Collaborator

@davidverdu davidverdu commented Feb 18, 2021

PR created on behalf of @fecony and related to this external PR #475

Check if project folder or resource already exist before generating new file. It will ask user if he wants to override existing file and continue or stop generating. If user agrees to override it file/project folder is removed. If declines then it will throw error for user to use different resource name. (See Images below)

Closes #305

Changes

  • Checks if project or file already exist.
  • export projectDir()
  • Adds checkProjectAlreadyExists() to check if project already exists in current directory.
  • Adds checkResourceExists() to check if resource already exists.
  • Unit tests for checkProjectAlreadyExists() and checkResourceExists() methods
  • Adds confirmPrompt() which is used by checkProjectAlreadyExists() and checkResourceExists() to reuse same code
  • Adds filePath function which was used in single method, to get path where resource should be generated. Is used for generation and to check if resource exists
  • Adds FileDir type for filePath method to pick only required params 'placementDir' | 'name' | 'extension'
  • Adds getResourceType() to get resource name from path.

Checks

  • Project Builds
  • Project passes tests and checks
  • Updated documentation accordingly

Additional information

Preview of CLI new messages

Screenshot 2020-10-21 at 23 12 36

Screenshot 2020-10-21 at 23 12 40

@boostercloud boostercloud locked as resolved and limited conversation to collaborators Feb 18, 2021
@davidverdu davidverdu requested review from a team and javiertoledo February 18, 2021 14:43
@boostercloud boostercloud unlocked this conversation Feb 18, 2021
@boostercloud boostercloud locked as resolved and limited conversation to collaborators Feb 19, 2021
@boostercloud boostercloud unlocked this conversation Feb 19, 2021
@davidverdu davidverdu merged commit 719bf7d into main Feb 19, 2021
@davidverdu davidverdu deleted the contrib branch February 19, 2021 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ask the user if they want to override existing files while using generators

3 participants