Support tracking apps#98
Merged
mschenk42 merged 9 commits intogit-time-metric:masterfrom Jun 30, 2019
Merged
Conversation
Member
|
Thanks for the PR @desaroger. This looks pretty good. I'll give this a more thorough review by the end of the week. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I wrote an issue (#96) some days ago, and this PR is my attempt to implement it myself.
This is my first time programming in Go, so any help/advice will be appreciated, no hard feelings, be honest haha
Summary
So, basically I added the option
--appto the record command, which indicates that the string passed is not a file, but an app name. Then it creates (if does not exists yet) the file.gtm/{appName}.appand tracks a simple event to that file. It's basically the same as the way the terminal was implemented, but for any app.Also, added the option
--app-offto some other commands, mimicking the--terminal-offbehaviour.What about terminal support
My idea was to try to "remove" the code related with the terminal support, but make the new code to work for the terminal in the exact same way. I did this for the templates, for the record command, etc. However I keep all the command flags, so everything keeps working as before for the terminal.
I wanted to add a "deprecated" warning when using the terminal flags, but I think is not my decision. Though I think the new app support makes the terminal flags to not make a lot of sense (my opinion).
You can mimic the terminal record command
gtm record -terminalwith the more generic flaggtm record -app terminal. It does exactly the same thing. I even changed the implementation of the former as an alias of the latter.Tests
I added some test cases, basically where there were tests for terminal support. Everyhing builds and pass the tests for me, but the lint tests (
make lint) throws lots of warnings. But I think is a problem of my Go setup, because those warning were thrown even with a clean cloned repo.Things changed
I tried my best to not change anything of the current behavior, and unless I did something wrong, the only things that have been change:
I hope I didn't made some big mistake. I will change anything if you see a better way of doing it.
Thanks!