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

Specify root path (--working-dir) by CLI argument #182

Closed
Glutexo opened this issue Apr 7, 2023 · 9 comments · Fixed by #195
Closed

Specify root path (--working-dir) by CLI argument #182

Glutexo opened this issue Apr 7, 2023 · 9 comments · Fixed by #195
Assignees
Labels
cli do it first enhancement New feature or request

Comments

@Glutexo
Copy link
Owner

Glutexo commented Apr 7, 2023

No description provided.

@Glutexo
Copy link
Owner Author

Glutexo commented Apr 13, 2023

Does adding an argument make sense when there is a current working directory? I posted a question on Software Engineering, and the only answer there says it does: mainly because Onigumo can’t assume what environment it runs in.

That opens a new question, whether to use the current working directory as a default. I incline towards yes because specifying . is just bothersome. Such behavior is, however, potentially dangerous because a typical run fastly creates many files. On the other hand, standard utilities like tar or wget do so too.

I propose to default to . but fail if the working directory is not clean. First, check naïvely whether the directory is empty, then scan the directory for unknown files to support resuming an interrupted run. Allow running in a tainted folder by providing an override/force flag.

@nappex, does this approach and its steps make sense to you? Any thoughts?

@Glutexo Glutexo added the enhancement New feature or request label Apr 13, 2023
@nappex
Copy link
Collaborator

nappex commented Apr 13, 2023

@Glutexo yes, absolutely. I agree with that opinion. Only one thought, I d like keep the option to change this default behaviour by another destination if the taste of user will be diff...
We can begin with not required cli parameter?!?
Then we can do some configuration file in future if we ll have more options to set.

@nappex nappex self-assigned this May 23, 2023
@nappex
Copy link
Collaborator

nappex commented Jun 2, 2023

We hit the problem with test when we need to change the current working directory to check, content of working directory. We use tmp_dir for purpose of testing, but when the current directory is constant we can not reach the content of tmp_dir then.

@nappex
Copy link
Collaborator

nappex commented Jun 2, 2023

Final implementation should looks like that:

  1. if not specified working dir by default current is used
  2. You can specify working dir by your taste anywhere you have the permission to
  3. Always validate state of choosed working dir. Is the dir suitable for Onigumo output..

@Glutexo
Copy link
Owner Author

Glutexo commented Jun 2, 2023

#162

It recommended to start with issue above. Currently we're handling CLI options by simple or basic approach. If we want to add another option to CLI which we want to handle, it's really good time to consider to handle CLI options by more advanced way.

@nappex
Copy link
Collaborator

nappex commented Oct 15, 2023

Consider the name --working-dir for the option

@nappex nappex changed the title Specify root path by CLI argument Specify root path (--working-dir) by CLI argument Oct 15, 2023
@Glutexo
Copy link
Owner Author

Glutexo commented Mar 8, 2024

Just found that Meson (a build system) uses -C for a working directory.

  -C WD                                         directory to cd into before running

If you find any other examples, drop them here, please.

@nappex
Copy link
Collaborator

nappex commented Mar 8, 2024

Just found that Meson (a build system) uses -C for a working directory.

  -C WD                                         directory to cd into before running

If you find any other examples, drop them here, please.

Nice catch cowboy! 🤠

I am little bit confused by sentence directory to cd, directory to current directory?!? That's a little bit confusing. Anyway big C looks great as --current-working-dir. But for the long version I may keep just the --working-directory

@Glutexo
Copy link
Owner Author

Glutexo commented Mar 16, 2024

Tar has:

-C <dir>  Change to <dir> before processing remaining files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli do it first enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants