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 some basic print methods #140

Merged
merged 10 commits into from
Feb 5, 2024
Merged

Add some basic print methods #140

merged 10 commits into from
Feb 5, 2024

Conversation

hadley
Copy link
Member

@hadley hadley commented Jan 30, 2024

library(chromote)

default_chromote_object()
#> <Chromote> (active)
#>   URL:  http://127.0.0.1:38235
#>   PID:  11387
#>   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

ChromoteSession$new()
#> <ChromoteSession> (active)
#>   Session ID: 6F1CB69127F8DF4A567EAEC27E57745B
#>   Target ID:  BEBCB2096CE541CC13F25EBBA5748937
#>   Parent PID: 11387

Created on 2024-01-30 with reprex v2.0.2.9000

@hadley hadley requested a review from wch January 30, 2024 21:59
@wch
Copy link
Collaborator

wch commented Jan 30, 2024

I like this summarized info, but for debugging purposes, I also often find it useful to see all the public and private stuff, so that I can find what to poke at. (Those IDs emitted by the new print methods are also only useful for debugging.)

Is there some way that we could make it obvious for people to figure out how to print all that other info?

@@ -544,7 +544,7 @@ ChromoteSession <- R6Class(
#' active debugging session?
mark_closed = function(target_closed) {
private$session_is_active <- FALSE
private$target_is_active <- target_closed
private$target_is_active <- !target_closed
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops

@hadley
Copy link
Member Author

hadley commented Feb 2, 2024

Now looks like this:

library(chromote)

x <- ChromoteSession$new()
x
#' <ChromoteSession> (session + target active)
#'   Session ID: D6A397FF2C4E44C53D67CC7F44CDD87C
#'   Target ID:  7C7D2B9E67D70B01A9664F143047205E
#'   Parent PID: 22035

x$parent
#' <Chromote> (active + alive)
#'   URL:  http://127.0.0.1:20993
#'   PID:  22035
#'   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome


# sleep --------------

x
#' <ChromoteSession> (target active)
#'   Target ID:  7C7D2B9E67D70B01A9664F143047205E
#'   Parent PID: 22035

x$parent
#' <Chromote> (alive)
#'   URL:  http://127.0.0.1:20993
#'   PID:  22035
#'   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

@hadley hadley merged commit e84718a into main Feb 5, 2024
12 checks passed
@hadley hadley deleted the print-methods branch February 5, 2024 17:30
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.

2 participants