-
Notifications
You must be signed in to change notification settings - Fork 1
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
Parse working_dir switch #195
Merged
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
3d4cca5
Parse switches output and component from CLI
nappex bec0fe6
Fix formatting
nappex 6d4929d
Merge branch 'master' into cli-work-dir
nappex 56acd64
Parse working_dir switch
nappex 31ff6d7
Merge branch 'master' into cli-work-dir
nappex 3b30377
Parse a new switch --working-dir from CLI
nappex 4e5fa37
Merge branch 'master' into parse-working-dir
Glutexo 25c5b16
Merge branch 'cli-work-dir' into parse-working-dir
nappex b0a4b89
Rename variable 'root_path' to 'working_dir'
nappex 4a11e4e
Update help message with usage of --working-dir
nappex 02c0b2c
Add shorthand version for switch --working-dir
nappex e8467f0
Merge branch 'master' into parse-working-dir
nappex 9452872
Add tests for working_dir switch usage
nappex d6a9b96
Merge branch 'master' into parse-working-dir
nappex 0988b13
Improve usage message for working_dir switch
nappex a5e9edc
Parametrize tests for working_dir switch with long and short
nappex 9fbdbaf
Be consistent with naming of variables in tests with the code
nappex c73a42f
Use inspect to print string in all descriptions of tests
nappex 47e06ed
Test switch --working-dir without value
nappex b3c5bf3
Test switch --working-dir with value '.'
nappex f883c28
Fix formatting
nappex e57bfa7
Update CLI help message for working dir
nappex e227fb2
Parametrize all tests with working-dir switch
nappex 4120a34
Remove test with no additional value
nappex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
defmodule Onigumo.CLI do | ||
def main(argv) do | ||
{[], [component]} = OptionParser.parse!(argv, strict: []) | ||
{parsed_switches, [component]} = OptionParser.parse!(argv, strict: [working_dir: :string]) | ||
module = Module.safe_concat("Onigumo", component) | ||
root_path = File.cwd!() | ||
module.main(root_path) | ||
|
||
parsed_switches | ||
|> Keyword.get(:working_dir, File.cwd!()) | ||
|> module.main | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Elixir style guide suggests using parentheses in the pipe operator.
I’d generally incline towards using them for functions without an argument, mainly for consistency. The Guide considers that preferred, although in other examples they use them without parens a lot themselves.