Giter VIP home page Giter VIP logo

mmotd's People

Contributors

jasonivey avatar

Stargazers

 avatar

Watchers

 avatar

mmotd's Issues

Ensure each source file has the right header

At some point when adding, moving and renaming files the habit of adding the vim control block started being left out.

On C++ source files this should just be:

// vim: awa:sts=4:ts=4:sw=4:et:cin:fdm=manual:tw=120:ft=cpp

On C++ header files this should be:

// vim: awa:sts=4:ts=4:sw=4:et:cin:fdm=manual:tw=120:ft=cpp
#pragma once

Transport exceptions from thread to main

Threads are no longer leaking exceptions. But now the errors are simply being ignored. Add library or logic (i.e. current_exception, make_exception_ptr and rethrow_exception) to transport the exceptions being thrown in threads to be caught and handled in main.

Add package management information provider

When logging into Ubuntu a fimiliar and useful set of information is the following:

1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable

And the following:

*** System restart required ***

This information can be easily gathered from reading a couple files.

Create working build on Linux

Linux is going to be a supported platform so the quicker there is a base implementation and CI runners the further it will push the project along.

Remove the "row_index" field from the output template

The output template is much more complicated than it needs to be. The average user will not ever use the feature unless they are highly, highly motivated to add/remove or otherwise customize their output.

The first thing to simplify the format of the output template is to remove fields which have turned out to serve no purpose. The row_index is the most obvious and the most aggravating.

Remove all reinterpret_casts and const_cast

Now that bit_cast is standard all instances of reinterpret_cast should be either removed or converted. Also, just listened to a cppcon web replay. Turns out modifying a const_cast variable is undefined behavior

Start documentation

This involves two steps:

  1. Need to decide what is the external API and how to expose it (i.e. shared library)
  2. Use doxygen or standardese to begin documenting the project.

utf8-table causes application crash in Linux

When the table component was first added it needed to be fort::utf8_table since there are non-ascii color escape sequences embedded within the strings. But when the results were validated on a Linux machine the table.to_string() method caused the application to crash (segfault).

Not having the time to properly debug the problem the table definition was switched to fort::char_table on Linux platforms and it appeared to solve the issue.

I'm not sure if the crash was due to the ssh session I was using or something special about the Linux terminal (i.e. TERM != xterm-256color). That should be the initial point of investigation.

Remove all submodules

After learning more of 3rd party libraries it seems there is a much better way of solving the problem than with git submodules.

CMake now has the FetchContent feature which allows you to specify an external project to be pulled and configured during the initial configure stage.

I think this will:

  1. Clean up the repository by removing the /external directory
  2. Never have to worry about submodules and whether users have updated them before compiling

Update README.md with demo and badges

The README.md has not been updated in some time. Now that there is a working version of the project the README.md should include a demo gif. In addition, now that the continuous integration build has been enabled the a badge should be added to show the pass/fail status.

Refactor exception catch sites

All of the exception catching location should be expecting std::exception and/or boost::exception. The boost::exception is currently setup to carry function, file, line and stack trace.

This should be refactored to carry a SourceLocation object and stack trace.

Then all boost::exception catch locations should extract this information.

In addition, the MakeExceptionMessage and all three overloads are making the exception objects/API unnecessarily difficult to grok/understand.

Lastly, when an exception is thrown I believe the stack trace is generated 3 or 4 times. It should be once!

Start using range-v3

I believe the usage of the C++ standard template library is going to be massively affected by the introduction to range-v3 library and all the capabilities they provide. I'd like to start using that as soon as possible for no other reason than personal gain. :)

Adjust api on thread entry functions to return void

All objects which query for computer information are derived from the InformationProvider abstract class.
They must all override the FindInformation() function to query and set the computer information. The class calls FindInformation() via the LookupInformation() method. Both of these methods were returning bool but since the method is being called via threads the result is always ignored.

These two methods should be changed to return void.

Discover what parts of the app could be useful as a shared library

I am the first to admit that I am not a front-end UI developer. For this reason, I'd like to take the most reusable parts of this application and intelligently package it together (with as few dependencies as possible) into a shared library (.so/.dylib/.dll) and the necessary public headers.

Decide on policy when there is no information

When monitor and resolution are queried on an Ubuntu Linux 20.04 virtual machine they are displayed as the following:

  GPU:                VMware SVGA II Adapter
  Monitor:
  Resolution:
  ...

Is this what should be displayed or should it be [unknown] or should the two labels not be displayed at all?

Update the CLI11 component to the next release

In my fervor to get everything up and running I forgot to make sure my submodules were properly pointing towards a release tag. As I've been removing the submodules I noticed that if I'm not using the HEAD version of CLI11 I can't compile. It's a pretty minor issue but I'd rather fix it by waiting for the next release from CLI11.

Revisit the logging library again

The plog logging library has been great. This issue is only to explore the possibility of either finding a small wrapper package around fmt::format or creating my own wrapper package around fmt::format.

In addition I would also like to add component discovery. (i.e. "ip address discovery" vs "prepare information for output")

Set default value for template when none is specified

When there is no -t or --template option specified on the command line set the default to the built in default template (i.e. the template which would be written out when a user specifies the create_template sub command.

This should be a simple refactor to change MakeOutputTemplate take two parameters or add an overload. The current method just takes a file name path. But this change would make it so it could take a string instead and load the output template from the string or the file name.

See: common/results/include/output_template.h

Add additional `option`/`values` to the config files

There are a number of additional information, if when provided, can ensure the validity of certain information providers.

The following items need to be added as either required or non-required options to the config file:

  • city
  • state
  • country
  • time zone
  • the default HTTPS weather endpoint
  • other HTTPS weather endpoints when the built-in one fails

Setup fmt::format library to use compile time enforcement

The fmt::format library can be setup to check at compile time that it's args are all valid. Unfortunately, to do this you either need to wrap the format string in FMT_STRING or define FMT_ENFORCE_COMPILE_STRING on the command line.

There is also options to compile the format string before runtime via the FMT_COMPILE macro.

Refactor usage of std::regex

Review usages of std::regex and determine if the use case is warranted for the heavy duty tool of a regular expression. If a regular expression is really called for then look for ways of either compiling it once for the binary or other ways of optimizing the usage.

Enable the --color=auto via isatty query

Recently the --color <WHEN> command line option was added. Taking the default usage from most every other command line application it accepts never, auto and always.

The never and always were implemented when the option was added. The auto needs to query the terminal (isatty) for what the stdout file is pointing towards.

Remove the dependency on both boost and jsoncpp

jsoncpp can be replaced with boost::property_tree. I believe property_tree is a viable header-only solution.

I haven't thought of how to boost::log with something else. But there are plenty of logging libraries. I just need to find a fast and small one (preferably header-only).

Then there is boost::beast and boost::asio for http and https networking. There should be something else available. I don't really feel like falling back on cUrl again.

Enable all the information providers

The way all the classes are dynamically registered pre-main style there is no-one actually referencing the classes directly. This makes the linker just wipe out their object files making their code disappear before they are able to register. To fix this the classes need to add an extern global that the main or test app can reference.

Add scope guard to the project

Andrei Alexandrescu and Petru Marginean proposed the concept of a scope guard using the RAII concept as the basis.
They have also proposed adding it to the standard, although I believe it has been pushed off for C++20. Luckily, Ricardo Abreu has done the work of wrapping the simplest version of the library in a GitHub repository with "The Unlicense".

https://github.com/ricab/scope_guard

Make sure submodules are linked to a release and not master

I've added quite a few submodules. Not really happy about it but don't see another way around doing https requests, logging, fmt, json etc. without relying on submodules.

I'm just not sure whether I checked out a released version of each submodule when I added them.

Refactor namespaces used in the project

Refactor the mish-mash of namespaces used within the project.

// root namespace in the project
namespace mmotd;
// root namespace in the project
namespace mmotd::core;
// common shared source for mmotd
namespace mmotd::information;

Remove the "column" field in the output template

A refactor to simplify the output template is to simplify the column structure. Right now, the columns are defined in the config->columns array. Turns out, this is more configurable than needed. It was designed this way so you could have columnA, columnC and columnE with empty columns between each. But at this point this seems to add more confusion than is necessary to the output template definition.

Research whether boost json library can be used for free

Both the boost::json library (introduced in version: 1_75) and library boost::describe (introduced in version: 1_77). Using these libraries instead of standalone projects, cloned from GitHub and then built as part of the build would be significantly more efficient.

Discover shell being used and version

A couple shell commands should help to identify which which shell binary is being used and then call each of these with the various --version syntax will provide the version numbers.

Add instructions for making changes to the Output Template

Create two more working Output Template json files within the config directory.

  • One which will produce output (almost) identical to what neofetch produces.

  • The second json file should be able to produce output (almost) identical to what screenFetch produces.

This will be done in hopes that it makes the transition to mmod even easier and provide an opportunity to dig into the Output Template json file

Add FromString method in common algorithms

Currently common/results/src/template_column_items.cpp contains the method:

std::optional<std::uint32_t> FromString(std::string_view str, int base = 10);

This should be templated on the return type and and input type and moved into common/include/algorithm.h. With this refactor more code can reuse this algorithm easily. Specifically, common/include/chrono_io.h has a need for it within the method:

inline std::optional<std::size_t> get_current_hour()

Make each of the submodules which discover new information independent from all others.

I'm going to attempt using the "Mediator" pattern which has the huge benefit that no other code knows about any other code. In addition, as the need rises (and there isn't a reason to believe otherwise), it will be relatively simple to add multithreading to the mediator. Since all other aspects of the app are running in complete seclusion they shouldn't know anything about it.

Pass templates to form output view

Depending on the template passed to the app the output should change what and how the information is displayed (i.e. number of columns, highlighting information, etc.).

Create working build on Windows 10

Windows 10 is going to be a supported platform so the quicker there is a base implementation and CI runners the further it will push the project along.

Create continuous integration

This has been left long enough. The project needs a continuous integration on pull request merge (or on any branch that receives a commit).

To begin with the first CI build should be done for macOS Catalina for the sake of simplicity. But there will be another issue where we add build support for Linux and Windows along with adding CI builds for their OS's as well.

There are two tasks involved in this issue:

  1. Add a test module to the project using gtest, cpptest or one of the many others I haven't used.
  2. Create a workflow inside GitHub which will build and run the tests on (at first) macOS Catalina.

Fix output when value doesn't exist

There are a couple instances where a value does not exist. Right now the output looks like:

  CPU:                     Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  CPU Cores:               6 (little endian)
  CPU Temperature:
  GPU:                     VMware SVGA II Adapter

In this case a virtual machine doesn't have access to the host to query the CPU temperature. But there are a few other instances as well. This needs to be switched into an option? maybe and if that option is enabled then these entire lines should be left out of the output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.