8000 refactored flag variable default values into consts by souvikmaji · Pull Request #67 · pesos/grofer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactored flag variable default values into consts #67

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

Merged
merged 3 commits into from
Oct 4, 2020

Conversation

souvikmaji
Copy link
Contributor

refers to #64

Copy link
Member
@MadhavJivrajani MadhavJivrajani left a comment

Choose a reason for hiding this comment

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

  • The check for valid PID can be done using the newly defined consts
if pid != defaultProcPid {
    ...
}
  • Feel free to remove the extra comments in the init() function.

cmd/proc.go Outdated
"pid",
"p",
defaultProcPid,
"specify pid of process")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"specify pid of process")
"specify pid of process",
)

< 8000 div class="TimelineItem-body"> @MadhavJivrajani MadhavJivrajani added the hacktoberfest-accepted Valid contribution and not spam label Oct 4, 2020
@souvikmaji
Copy link
Contributor Author

What validation should i add for pids?

@MadhavJivrajani
Copy link
Member

Validation is already taken care of, since you've added the const defaultProcPid, you could use that in the check on line 64 so that if a default value should be changed, it only needs to be changed in the defined consts and not anywhere else.

Copy link
Member
@MadhavJivrajani MadhavJivrajani left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for your contribution! I'll wait for another review from either @Gituser143 or @metonymic-smokey before merging.

@MadhavJivrajani
Copy link
Member

@souvikmaji a PR for changing PID types has already been made and ideally should not be a part of this PR. Please revert those changes for now.

@souvikmaji
Copy link
Contributor Author

Reverted

@MadhavJivrajani MadhavJivrajani merged commit d9401d0 into pesos:master Oct 4, 2020
@MadhavJivrajani MadhavJivrajani mentioned this pull request Oct 4, 2020
8 tasks
@souvikmaji souvikmaji mentioned this pull request Oct 4, 2020
MadhavJivrajani added a commit that referenced this pull request Jan 4, 2021
* Add feature for more CPU info (#46)

* added code for additional cpu info

* added cpu rates to CPULoad type

* Made UI for CPU info

* Cleaned use fo sync.once variables for faster UI rendering

Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>

* added cpuinfo in README

* removed stray comment

* Update README

* Add extra comments

* Refactored printStats, becoming serveStats! (#50)

Co-authored-by: lrb <lrb@envs.net>

* Readme update

* Remove duplicate error printing. (#52)

* added common error general.ErrCanceledByUser

* Fix error handlings under cmd/root (#48)

* use context to cancel executions

* use errgroup in cmd/root.go

* every functions returns error

* use context to stop ServerFuncs

* add license to src/general/errors.go

* Add completion subcommand

* Clean up description and remove generic stuff

* Added license header

* Render Grid on scroll to fix UI lag (#60)

* Replaced for loops with strings.Repeat() for whitespace generation

* inconsistent allignment in list of child process for gropher proc command (#61)

* Fixes #45 (inconsistent allignment in list of child process for  command)

* remove temp test logic and run gofmt

* add yellow color to PID text irrespective of any condition

* make color scheme consistent with AllProcsPage

* Add Cute ASCII for error messages! (#62)

* Added cute ascii art!

* Updated goobe art

* Renamed doggo.go to error.go

* Change tabs to spaces in license

* Change yourprogram to grofer

* Add section about completion in readme

* refactored flag variable default values into consts (#67)

* refactored flag variable default values into consts

* removed comment and added new line

* checking with default value before validation

* Fixed issues with text being invisible under bright backgrounds

termui defaults to ColorWhite, which displays white text irrespective of terminal. Using ColorClear instead uses the default text color that the terminal uses.

ISSUES: Plot widget does not accept changes to the color of the axes for some reason, hence it remains grey under both Dark and Light-colored backgrounds.

* issue #65 (#68)

* issue #65

* fix: uint32->int32

* fix wrong type in flag initialization in root.go

* Add keybindings to kill process in list (#16)

Avoid storing all procs, parse PID when killing the process

* Add error handling in process kill

Exit proc gracefully and fix formatting

* Change Kill key to K, ignore error if PID does not exist

* confirm process kill, refactor some parts

* Change color of selected process when killing

Paint row red on error in proc

Also, changed row color to magenta when selected for killing

* Check if process still exists when killing

 - renamed `paused` to `killSelected`
 - removed unnecessary once statement in updateProcs
 - if a process is selected for killing, check if the
   PID still exists on every update

Fixed selection color not persisting

* Fix UI closing in proc -p

* Feature/help (#74)

* Toggle help window in procs page

* Refactor to separate help message from widget

* Use ui.List instead of ui.Block

ui.List provides some styling and a simpler way to load data, as well as
option to wrap lines, allowing easier resizing of the widget

* Fix resizing of help widget

* Add keybindings for main and `proc -pid` pages

* Add help widget to `proc -pid` page

* Add help widget to main page

* Fix escape keybinding to clear screen first

Escape was mapped to exiting the help screen, but the help menu would
persist for a while on top of the page (until the next tick). This
causes the redraw to happen immediately

* Fix resizing issue

* Fix formatting error

* Add scroll in help menu, fix render delay

Add scroll option for the help widget when all lines are not visible.
Also fix the render delay when help widget is exited with <Esc>

* Fix formatting and spacing issues

* Fix procGraphs rendering

* Remove unneccesary comment

* Use slice of strings instead of string

* Add kill keybind to help message

* Remove unused module

* Re-add scroll in help menu

* Fix formatting issue

* update readme and root.go for documentation

* update readme for feature/help

* Fix UI flickering. Removed unnecessary calls to ui.Clear()

* Added cute beaver and elephant ASCII Art

* Clear background UI on rendering help

* Fix UI clearing for grofer --cpudinfo and initialize help

* made functions not exportable, fixed error in random selection#

* Removed comments of unexported Functions

* GH-75: using after channel instead of delay so exit is immediate (#77)

* GH-75: using after channel instead of delay so exit is immediate

* GH-75 BUG exit time too slow

- Using single select loop for generalStats.
- Using select time.After instead of time.Delay for proc single and multiple.

* GH-75: using ticker instead of after

* GH-75: using common tick util for cpu info

* GH-75: added license to tickutils.go

* Add .circleci/config.yml

* Set working directory for circleci

* Modified tests

* Attempt dependecy fix for test

* Update go version

* Attempt python install

* Attempt python install as root

* Remove travis and testing circleci

* Fix indentation and shift CI to circleci

* Add .circleci/config.yml

* Remove extra comments from CI config

* Show correct error msg. on neg. pids (#86)

Giving a pid 0 from `grofer proc -p 0` is the same as
`grofer proc`.

Fixes #86

* Documented PID 0 in grofer proc

* Add export functionality  (#88)

* added boilerplate code for exporting json

* forgot license :p

* removed test json

* fixed file descriptors

* add export functionality for json

* added better validation of file names and slight refactoring done

* remove explicit extension append for default case

* ocd fix

* delete output of test run

* remove unescessary comments

* change export type validation in map

* change exportable consts to non-exportable consts

* change export type validation

* Add JSON export functionality (#84)

* Implement JSON per proc export

* Update switch conditions for export

* Restructured packages

* Add license to procExport.go

* Fixed package name, removed output file before creation

* issue #65 (#68)

* issue #65

* fix: uint32->int32

* fix wrong type in flag initialization in root.go

* Add keybindings to kill process in list (#16)

Avoid storing all procs, parse PID when killing the process

* Add error handling in process kill

Exit proc gracefully and fix formatting

* Change Kill key to K, ignore error if PID does not exist

* confirm process kill, refactor some parts

* Change color of selected process when killing

Paint row red on error in proc

Also, changed row color to magenta when selected for killing

* Check if process still exists when killing

 - renamed `paused` to `killSelected`
 - removed unnecessary once statement in updateProcs
 - if a process is selected for killing, check if the
   PID still exists on every update

Fixed selection color not persisting

* Fix UI closing in proc -p

* Feature/help (#74)

* Toggle help window in procs page

* Refactor to separate help message from widget

* Use ui.List instead of ui.Block

ui.List provides some styling and a simpler way to load data, as well as
option to wrap lines, allowing easier resizing of the widget

* Fix resizing of help widget

* Add keybindings for main and `proc -pid` pages

* Add help widget to `proc -pid` page

* Add help widget to main page

* Fix escape keybinding to clear screen first

Escape was mapped to exiting the help screen, but the help menu would
persist for a while on top of the page (until the next tick). This
causes the redraw to happen immediately

* Fix resizing issue

* Fix formatting error

* Add scroll in help menu, fix render delay

Add scroll option for the help widget when all lines are not visible.
Also fix the render delay when help widget is exited with <Esc>

* Fix formatting and spacing issues

* Fix procGraphs rendering

* Remove unneccesary comment

* Use slice of strings instead of string

* Add kill keybind to help message

* Remove unused module

* Re-add scroll in help menu

* Fix formatting issue

* update readme and root.go for documentation

* update readme for feature/help

* Fix UI flickering. Removed unnecessary calls to ui.Clear()

* Added cute beaver and elephant ASCII Art

* Clear background UI on rendering help

* Fix UI clearing for grofer --cpudinfo and initialize help

* made functions not exportable, fixed error in random selection#

* Removed comments of unexported Functions

* GH-75: using after channel instead of delay so exit is immediate (#77)

* GH-75: using after channel instead of delay so 
8680
exit is immediate

* GH-75 BUG exit time too slow

- Using single select loop for generalStats.
- Using select time.After instead of time.Delay for proc single and multiple.

* GH-75: using ticker instead of after

* GH-75: using common tick util for cpu info

* GH-75: added license to tickutils.go

* Made general export line by line json

* Add export functionality for per proc

* Add .circleci/config.yml

* Set working directory for circleci

* Modified tests

* Attempt dependecy fix for test

* Update go version

* Attempt python install

* Attempt python install as root

* Remove travis and testing circleci

* Fix indentation and shift CI to circleci

* Add .circleci/config.yml

* Remove extra comments from CI config

* Removed redundant export files

* Fix formatting

* Update license in cpuInfo

* Fix precision for exported fields

* Add prompt to confirm profile overwrites

* Moved roundOff to utils and removed redundant print statements

* Add overwrite prompt to per proc export, format prompt text with filname

* Log errors in export iterations

* Nested error handling

* Update documentation

* Remove mentions of JSON

* Add export type explanation

Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Madhav Jivrajani <madhav.jiv@gmail.com>
Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>

Co-authored-by: Bhargav SNV <44526455+Gituser143@users.noreply.github.com>
Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>

* removed extraneous RenderCPUInfo func

Co-authored-by: Bhargav SNV <44526455+Gituser143@users.noreply.github.com>
Co-authored-by: Gituser143 <bhargavsnv100@gmail.com>
Co-authored-by: mattharwood <matt@mattharwood.com>
Co-authored-by: lrb <lrb@envs.net>
Co-authored-by: __touk__ <zerouali.t@gmail.com>
Co-authored-by: egawata <egawa.takashi@gmail.com>
Co-authored-by: Anirudh H M <anihm136@gmail.com>
Co-authored-by: Siddhant Sinha <siddhant94@users.noreply.github.com>
Co-authored-by: Anirudh Haritas Murali <49116134+anihm136@users.noreply.github.com>
Co-authored-by: Souvik Maji <souvikmaji94@gmail.com>
Co-authored-by: Kunal Bhat <kunal.bhat2001@gmail.com>
Co-authored-by: Prince Verma <prncvrm@gmail.com>
Co-authored-by: Samyak S Sarnayak <samyak201@gmail.com>
Co-authored-by: localleon <me@lrau.xyz>
Co-authored-by: ataboo <doubar2001@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Valid contribution and not spam
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0