Skip to content

Commit

Permalink
Merge pull request #104 from r-world-devs/maciekbanas/43/add-print-me…
Browse files Browse the repository at this point in the history
…thod-to-gitai-object

Prettify printing of the GitAI object.
  • Loading branch information
maciekbanas authored Feb 17, 2025
2 parents 2444c04 + bc288bd commit 3bac701
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: GitAI
Title: Extracts Knowledge From Git Repositories
Version: 0.0.0.9017
Version: 0.0.0.9018
Authors@R: c(
person("Kamil", "Wais", , "[email protected]", role = c("aut", "cre")),
person("Krystian", "Igras", , "[email protected]", role = "aut"),
Expand Down
41 changes: 40 additions & 1 deletion R/GitAI.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ GitAI <- R6::R6Class(
initialize = function(project_id) {

private$.project_id <- project_id
},

print = function() {
cat(cli::style_bold("A ", cli::col_yellow("GitAI"), " object: \n"))
private$print_project_id()
private$print_files()
private$print_llm_data()
private$print_db_data()
}
),

Expand Down Expand Up @@ -56,6 +64,37 @@ GitAI <- R6::R6Class(
.gitstats = NULL,
.files = NULL,
.repos_metadata = NULL,
.files_content = NULL
.files_content = NULL,

print_project_id = function() {
cat(cli::col_br_yellow("Project ID:"), private$.project_id, "\n")
},

print_files = function() {
if (is.null(private$.files)) {
cat(cli::col_br_yellow("Files:"), cli::col_grey("not added"), "\n")
} else {
cat(cli::col_br_yellow("Files:"),
paste0(private$.files, collapse = ", ")
, "\n")
}
},

print_llm_data = function() {
if (is.null(private$.llm)) {
cat(cli::col_br_yellow("LLM:"), cli::col_grey("not set"), "\n")
} else {
cat(cli::col_br_yellow("LLM:"), "set", "\n")
}
},

print_db_data = function() {
if (is.null(private$.db)) {
cat(cli::col_br_yellow("Database:"), cli::col_grey("not set"), "\n")
} else {
browser()
cat(cli::col_br_yellow("Database:"), "set", "\n")
}
}
)
)

0 comments on commit 3bac701

Please sign in to comment.