Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to Consider the Case Senstive feature in CLI while creating new file. #790

Open
AayushSaini101 opened this issue Sep 10, 2023 · 13 comments
Labels
area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. enhancement New feature or request good first issue Good for newcomers

Comments

@AayushSaini101
Copy link
Contributor

Reason/Context

Please try answering a few of those questions

  • Why do we need this improvement?
    CLI should be case-sensitive while creating the file, currently, it is treating tutorial.yml and Tutorial.yml the same and enables to creation of files.
    image

  • How will this change help?
    It will always be optimal to consider the case-sensitive feature in the CLI

Description

Please try answering a few of those questions

  • Will this be a breaking change?
  • No, it will not break any current changes only some validation added.
@AayushSaini101 AayushSaini101 added the enhancement New feature or request label Sep 10, 2023
@github-actions
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@Souvikns
Copy link
Member

I think this is where the issues is

const content = await readFile(fileNameToWriteToDisk, { encoding: 'utf8' });

https://stackoverflow.com/questions/27367261/check-if-file-exists-case-sensitive
https://forums.raspberrypi.com/viewtopic.php?t=119198

@AayushSaini101
Copy link
Contributor Author

Thanks, @Souvikns Yes, here is the issue. that need to be changed, but, If we write the logic to create a new file after comparing the case as well, we cannot because OS doesn't allow to creation of two separate files with different cases.

@Souvikns
Copy link
Member

Souvikns commented Sep 12, 2023

Yeah, could we change the file-name that we get as input to lowercase and then create the file, or will it create inconvenience for the user?

@AayushSaini101
Copy link
Contributor Author

AayushSaini101 commented Sep 12, 2023

@Souvikns We can do this when the user tries to create a file of the same name but different case it should get a message that a particular file is present with a different case. Please change the name. What's your thought?

@AayushSaini101
Copy link
Contributor Author

@Souvikns We can do this when the user tries to create a file of the same name but different case it should get a message that a particular file is present with a different case. Please change the name. What's your thought?

@Souvikns @fmvilas Any thoughts on this?

@Souvikns
Copy link
Member

@Souvikns We can do this when the user tries to create a file of the same name but different case it should get a message that a particular file is present with a different case. Please change the name. What's your thought?

🤔 actually the less warning from CLI the better the user experience, it would be better to handle this issue internally, and in our case, we can't really save two same file names with lower and uppercase because of how the filesystem works in nodejs. In my opinion, the error message we have right now works fine, and no need to change anything.

@derberg
Copy link
Member

derberg commented Sep 25, 2023

wasn't it solved?

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Jan 24, 2024
@peter-rr
Copy link
Member

🤔 actually the less warning from CLI the better the user experience, it would be better to handle this issue internally, and in our case, we can't really save two same file names with lower and uppercase because of how the filesystem works in nodejs. In my opinion, the error message we have right now works fine, and no need to change anything.

I agree with this approach 👍

@Souvikns Shouldn't we convert the input to lowercase as you proposed here?

@github-actions github-actions bot removed the stale label Apr 17, 2024
@Amzani
Copy link
Collaborator

Amzani commented Jul 5, 2024

/gfi ts

@asyncapi-bot asyncapi-bot added area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. good first issue Good for newcomers labels Jul 5, 2024
@SagarSharma2809
Copy link

@Souvikns We can do this when the user tries to create a file of the same name but different case it should get a message that a particular file is present with a different case. Please change the name. What's your thought?

🤔 actually the less warning from CLI the better the user experience, it would be better to handle this issue internally, and in our case, we can't really save two same file names with lower and uppercase because of how the filesystem works in nodejs. In my opinion, the error message we have right now works fine, and no need to change anything.

Agreed that the less warnings the better user experience but since many doesn't/ will not know the OS case-insensitivity they will get confused as to why different name is not working and if Tutorial.txt already exist. Thus, will try TUTORIAL.txt or something and fail.

Maybe, we can give a better CLI response like " Error: A file named "tutorial.txt" already exists in the directory.

Your current file system is case-insensitive, so "Tutorial.txt" would be treated as the same file name.

Please choose a different name for your new file or delete/rename the existing file."

@SagarSharma2809
Copy link

@Souvikns We can do this when the user tries to create a file of the same name but different case it should get a message that a particular file is present with a different case. Please change the name. What's your thought?

🤔 actually the less warning from CLI the better the user experience, it would be better to handle this issue internally, and in our case, we can't really save two same file names with lower and uppercase because of how the filesystem works in nodejs. In my opinion, the error message we have right now works fine, and no need to change anything.

Agreed that the less warnings the better user experience but since many doesn't/ will not know the OS case-insensitivity they will get confused as to why different name is not working and if Tutorial.txt already exist. Thus, will try TUTORIAL.txt or something and fail.

Maybe, we can give a better CLI response like " Error: A file named "tutorial.txt" already exists in the directory.

Your current file system is case-insensitive, so "Tutorial.txt" would be treated as the same file name.

Please choose a different name for your new file or delete/rename the existing file."

I am willing to change the CLI response if this idea sounds ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/typescript Specify what technical area given issue relates to. Its goal is to ease filtering good first issues. enhancement New feature or request good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

7 participants