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

Add support for media dir environment variable. #26

Conversation

abhijitnathwani
Copy link
Contributor

@initialcommit-io as discussed, I have implemented the changes for setting the environment variable. Let me know if it requires any other updates. I have tested on Windows/Linux. I don't have access to a Macintosh to test it. Can you please verify this once ?
Fixes #4

README.md Outdated
@@ -339,6 +339,14 @@ Customize the output image/video directory location:
$ git-sim --media-dir=path/to/output status
```

Optionally, set the environment variable `git_sim_media_dir` to default that as the media directory, if no `--media-dir` is provided.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update to something like:

Optionally, set the environment variable git_sim_media_dir to set a global default media directory, to be used if no --media-dir is provided. Simulated output images/videos will be placed in this location, in subfolders named with the corresponding repo's name.

README.md Outdated
$ export git_sim_media_dir=path/to/media/directory
$ git-sim status
```
Note: `--media-dir` takes precedence over the environment variable. If you set the environment and still provide the argument, you'll find the media in the path provided by `--media-dir`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a period at the end of the second sentence.

config.media_dir = os.path.join(os.path.expanduser(args.media_dir), "git-sim_media")
config.verbosity = "ERROR"

# If the env variable is set and no argument provideed, use the env variable value
if os.getenv('git_sim_media_dir') is not None and args.media_dir == '.':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can shorten the if statement if we remove the is not None and just use if os.getenv('git_sim_media_dir') and args.media_dir == '.':

config.media_dir = os.path.join(os.path.expanduser(args.media_dir), "git-sim_media")
config.verbosity = "ERROR"

# If the env variable is set and no argument provideed, use the env variable value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo - "provideed" instead of "provided"

Copy link
Contributor

@initialcommit-io initialcommit-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are multiple similar commits here in this pull request, can you squash it into just 1? And make the changes I requested in the my comments?

Updated the README to reflect the env variable changes.

Signed-off-by: Abhijit Nathwani <[email protected]>
Signed-off-by: Abhijit Nathwani <[email protected]>
@abhijitnathwani
Copy link
Contributor Author

Thanks for the review! I have updated it as per your comments.

@initialcommit-io initialcommit-io merged commit c1e9b61 into initialcommit-com:main Jan 26, 2023
@abhijitnathwani abhijitnathwani deleted the add-env-variable-for-media-dir branch January 28, 2023 16:03
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.

Feature Request: Do not store media in local project directory
2 participants