Giter Club home page Giter Club logo

qubes-completion's People

Contributors

gonzalo-bulnes avatar jamke avatar neoniobium avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

qubes-completion's Issues

Generate and review tests for all command cases

Currently tests are not covering all commands and cases.
That should be improved. We need to generate and manually review tests for all commands.
The project includes automatic tool generating cases, but manual review and work is still required.

Any help with test will be appreciated.

Updates for `4.2`

Since Qubes 4.2 is officially out now there are some new tools now, for what could be in principle bash completion provided for. There are also some tools like qubesctl what have new options available.

I open this issues to collect to tools affected:

New tools introduced:

  • qubes-fwupgmr
  • qubes-vm-update
  • qubes-guivm-session
  • qubes-prepare-vm-kernel
  • qubes-app-menu
  • qubes-update-gui
  • qubes-policy-lint
  • qubes-policy-editor

Tools with new options or new possible arguments

  • qubesctl
  • qvm-features

Some completions suggest dom0 but should not

Some command like qvm-shutdown or qvm-kill suggest dom0 as an target VM. This should not be the case.

Possible Solution:

  • Remove dom0 each time by hand.
  • Rework __get_qubes_list and add new input arguments options like running- for getting all running qubes but dom0

Run test suite automatically in a GitHub Action

Context

There is a test suite, that is progressively being augmented to provide comprehensive regression testing coverage.

Overview

When I (or someone else!) add or modify completion commands, I want to make sure the modification don't break existing functionality.

Of course, contributors and maintainers are supposed to run the test suite (at least) before new releases are created, (ideally) before PRs are merged. In my experience, the green ticks that GitHub adds in PR when the test suite runs automatically, and the typical green badge in the README help making sure that the test suite failures are indeed detected early enough for their cause to be easy to track.

How

While a number of continuous integration services exist, creating a GitHub Action seems to me like a pretty good option (if not the best). Thoughts?

Considerations

  • How often to trigger the test suite, given the time it takes to run. (Almost 20min on my machine, for reference.)

BATS tools could be included to make testing setup easier

Overview

  • Currently, testing currently depends on three tools provided by the BATS framework (docs):
  • Those need to be present in a specific path of the project before the existing test suite can be executed (test/test_helper/bats-*).
  • Given their license, they could be included in the project

Why

  • Remove the need for would-be contributors to fetch and add them themselves
  • Open the possibility of running the test suite in a GitHub Action (I'll open a separate issue to discuss that)

How

Git submodules

Pros: Adding the three BATS repositories as git submodules makes it easier to keep track of which versions of the tools are currently in use, and eventually to update them.
Cons: However, it requires being aware of submodules when pulling the repository. (Mitigation: a note can be added to the Tests section of the documentation.)

Copies

A simple copy of the BATS tools can also be included with the project.

Pros: Simple. Those become part of the project like any other file, and no special setup is needed before tests can be run.
Cons: It is less obvious which version is used (which may or not matter).

Improve completion for `qubesctl` command

We can significantly improve using salt in qubes when we provide further completion the qubesctl command.

Some basic completion for the first non-optional argument should at least be:

  • top.enable
  • top.disable
  • top.enabled
  • state.highstate
  • state.apply

This will be easy to implement and could be easily expanded.

The really interesting part however would be to implement path completion the the salt commands that want one or more top files as an input.

Unfortunately the target file's default directory is within /srv/ which is only readable for the root user. Therefore I suppose we can only path complete after becoming root.

Furthermore after the top file[s] additional optional argument can be provided like log-level=debug

Therefor the full completion is something like

qubesctl [--qubes-options] salt-command path-to-top-file[s] [--salt-specific-arguments] 

References:

I volunteer to tackle this but I wanted open an issue first to discuss.

Missing copyright statements in file that uses GPL-licensed code

Overview

While the intent seems clear, the current use of code from the bash-completion project doesn't quite follow the license rules about re-use. (In a gist: keep the copyright statements, add your own to any file that contains a significant piece of code that someone else contributed to writing. This doesn't pretend to be legal speech, I am not a lawyer.)

Specifically src/qubes-completion.sh is missing the copyright statements that correspond to the piece of code derived from bash-completion.

The THIRDPARTY file contains a disclaimer about the origin of the code. However, that is not quite sufficient to fulfill the license obligations. (Standalone disclaimers like that are generally used for libraries or assets that are redistributed unmodified, but that is not the case here.)

Why bother?

I want this project to thrive, and I think all authors should get proper credit for their work. It turns out that's exactly what the copyright rules surrounding licensed do, in an unambiguous manner. The same rules will ensure that projects derived from this one give proper credit to its author(s). ๐Ÿ™‚

Fix (option 1)

In this case, the situation is fairly straightforward and the fix easy:

  • src/qubes-completion.sh contains code derived from code that was released under the GPL-2.0-or-later (according to the THIRDPARTY file)
  • that the copyright headers that are included in THIRDPARTY should appear in src/qubes-completion.sh
  • once that's done, the THIRDPARTY file becomes redundant

Fix (alternative)

If identifying specifically the piece of code that's derived from bash-completion is desired, that function could be extracted to a separate file, that would contains all the copyright statements.

At release time, the release artifact could be created by concatenating all source files. (That does add some tooling to the repo, for example a Makefile, which may or not be desirable.)

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.