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

feat:add color and ttl check #199

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Pavankumar07s
Copy link

@Pavankumar07s Pavankumar07s commented Nov 13, 2024

checked all the points.
Got 100perset test passed.
Screenshot from 2024-11-14 00-11-50

Screenshot from 2024-11-14 00-11-37

Screenshot from 2024-11-14 00-14-28

@Pavankumar07s
Copy link
Author

@jviotti, you're a great help. But can you assist me with this broken test?

@Pavankumar07s
Copy link
Author

Alright i think i got an error.

@Pavankumar07s
Copy link
Author

hiii @jviotti can you assist me for windows workflow.

@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project(jsonschema VERSION 4.3.0 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(vendor/noa/cmake/noa.cmake)

include_directories(vendor/termcolor/include)
Copy link
Member

Choose a reason for hiding this comment

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

Note termcolor is a CMake project with its own CMakeLists.txt, so instead of including its files directly here (which is not a best practice), you should create a cmake/FindTermColor.cmake and them here do find_package(TermColor REQUIRED) like we do for other dependencies

Copy link
Author

Choose a reason for hiding this comment

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

Alright @jviotti got your point.

#ifdef _WIN32
#include <io.h>
#define isatty _isatty

Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary blank line?

Copy link
Author

Choose a reason for hiding this comment

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

Alright 👍 i will remove it.


#define fileno _fileno
#else

Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary blank line?

Copy link
Author

Choose a reason for hiding this comment

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

Alright i will also remove it.

@@ -88,6 +99,13 @@ For more documentation, visit https://github.com/sourcemeta/jsonschema

auto jsonschema_main(const std::string &program, const std::string &command,
const std::span<const std::string> &arguments) -> int {
bool use_colors = true;
if (std::find(arguments.begin(), arguments.end(), "--no-color") !=
Copy link
Member

Choose a reason for hiding this comment

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

We have a parse_options helper function to avoid re-parsing command line arguments in every place. Can you make use of that instead?

Also, you probably want to support a short version of this. Maybe -n?

Finally, you should document this new option on the help page and on docs/

Copy link
Author

Choose a reason for hiding this comment

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

Alright ,i am getting really exited.

Copy link
Member

Choose a reason for hiding this comment

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

Actually, just to keep things simpler and merge this sooner, let's avoid --no-color altogether. Just do it purely depending on the TTY stuff. We can then get into parsing that option on specific commands later on

Copy link
Author

Choose a reason for hiding this comment

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

I am not feeling good,i think my health is not good.I am going home i will work on this in few days. Thanks.

@@ -117,7 +135,12 @@ auto jsonschema_main(const std::string &program, const std::string &command,
<< sourcemeta::jsonschema::cli::PROJECT_VERSION << "\n";
std::cout << "Usage: " << std::filesystem::path{program}.filename().string()
<< " <command> [arguments...]\n";
std::cout << USAGE_DETAILS;
if (use_colors) {
std::cout << termcolor::yellow << USAGE_DETAILS << termcolor::reset
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it makes much sense to color out the entire help. Maybe just color out the project name in line 134?

@Pavankumar07s
Copy link
Author

@jviotti you tell me why windows build is getting failed?

Copy link
Member

Choose a reason for hiding this comment

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

Can you mask all unnecessary files (except LICENSE) using vendorpull? See https://github.com/sourcemeta/vendorpull#masking. Otherwise we are even including screenshots from termcolor here

@jviotti
Copy link
Member

jviotti commented Nov 14, 2024

I'm not sure. The error is weird indeed. Let's fix all of the other things, and if it still fails when the PR is ready to merge, I'll take a proper look!

@Pavankumar07s
Copy link
Author

Hii @jviotti, I know this is a bit of an unusual request, but I was wondering if you could share some resources that could help me delve deeper into this topic.

@jviotti
Copy link
Member

jviotti commented Nov 14, 2024

Hey @Pavankumar07s, about what topic specifically? Maybe this page where we list useful resources in general help? https://www.sourcemeta.com/resources/

@Pavankumar07s
Copy link
Author

I am not feeling good,i think my health is not good.I am going home i will work on this in few days. Thanks.

@Pavankumar07s
Copy link
Author

I have already shared my situation, but I think it was in an unnoticed place.

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