Fixing #21 while executing from pipx and script #22
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.
console scope error case while using pipx:
Since console is only used within Logger class, I moved the declaration from
if __name__ == '__main__':condition statement block to Logger constructor making it a property.logger scope error case while using pipx or calling pywhisker as a script:
logger definition was moved to main function while doing the pipx support but can't be found within ShadowCredentials execution.
ShadowCredentials class assume a global logger so instead of making it global in main, I give the main instance to ShadowCredentials so he can refer to its copy or create it by itself if it's not defined within constructor.
It's still an implicit coupling but not as bad design than a global variable and it was much easier to do this as the state of the code.
If I had more time, isolating Logger and ShadowCredentials would be my choice and declare the Logger using dependency injection
I tested this code as a pipx module and a standalone script against a HTB prolab, no more errors on my side.
Feel free to ping me if I need to change a few things ! :)