Skip to content

PowerCommands/PowerCommands2022

Repository files navigation

Power Commands

You could see PowerCommands as your CLI application starter kit. It is a structured framework for creating your own customized command prompt to perform tasks with the full control from your command environment. That means no time-consuming hassling with a GUI, try catch block, validate your input, you do not need to write a zilion test classes either. Just concentrate on the code, create your commands and run the Console application.

Follow progress on twitter drawing

Version 1.0.3.2

Released 2023-12-26

  • DialogService.ListDialog has major improvements with paging and select all functionality and have been moved to a new service, named ListService.
  • ProxyCommand now handles suggestion overrides in configuration.
  • ConsoleTableService.RenderTable generic constraint new() removed since it is not needed.
  • Bookmarks in CdCommand now handles %USERNAME% as a placeholder for current user in paths.

Version 1.0.3.1

Released 2023-11-30

  • Adjusted the Power Command to be run with a service account and use encryption, update the setup to reflect this.
  • Added general option --pc_force_quit in CommandBase to be used with any command to force application to quit.
  • Improved encryption.
  • Bug fix DialogService.ListDialog now handles 0 input more gracefully.
  • Bug fix CommandBase now return RunResultStatus.Quit when using Quit()

Release 2023-11-18

  • Updated to .NET 8
  • Using C# 12
  • Updated YamlDotNet to current latest stable version
  • Updated Microsoft.Extensions.Logging.Abstractions to current latest stable version
  • Updated Serilog and Serilog.Sinks.File to current latest stable version

The core components offering this to your custom PowerCommands

  • Command completion, with history, suggestions, options and support for Path/File navigation and color highlighting when typing a valid command
  • Secret handling to protect sensitive information like password or authentication tokens in the configuration file.
  • Configuration with YAML (built to be very easy to extend)
  • Logging (using Microsoft.Extensions.Logging.ILogger)
  • Built in help system with the use of attributes
  • Run as job
  • Validation rules with attribute
  • Toolbar labels to guide the user
  • Diagnostic
  • Progressbar
  • Dialog service (with password prompting)
  • Navigation with working directory and familiar cd and dir commands
PowerCommand_demo_toolbar.mp4

Start your journey

Create a new VS Solution

Create a new Command

Commands development

Design your Command

Power Commands Design attribute

Override Design attribute in config file

Patterns to use the Toolbar with dynamic content

Command base class

Handling the Input

Dialog services

ListCommand.mp4

Using Options

Simple automated test

Output to the Console guideline

Automation

Run your command as job

Core framework

PowerCommandsRuntime

Configuration and documentation

Basic application configuration

Extend your configuration

Configure your environment to use encrypt/decrypt secrets

Documentation index

Console Input

Shortcut guide and listening on keyboard events

Architecture

Design principles and guidlines

Customize your project


Implementations

PainKiller Security Tools

PainKiller Security Tools combines CycloneDX and Dependency Track to let you create SBOM files from git repos and import them in to OWASP Dependency Track which gives you a nice GUI where you can analyze your repos vulnerabilities.

cdxgen

PainKiller Security Tools on Github

Links

10 design principles for delightful CLIs