Socket
Socket
Sign inDemoInstall

github.com/BradleyChatha/decorator

Package Overview
Dependencies
5
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/BradleyChatha/decorator

A simple package for adding colourful comments onto source code lines primarily for the use of user-friendly error messages.


Version published

Readme

Source

Overview

Decorator is a simple library for adding comments onto lines of text, primarily aimed at user-friendly error messages.

For example:

image

The above output was generated from the following code:

  var d Decorator
	
  d.AddLine("printf(\"%s\", 400)", LineMetadata{FileName: "main.c", LineNumber: 5})
  d.ColourLine(0, LineColour{From: 0, To: 6, Colour: FgYellow})
  d.ColourLine(0, LineColour{From: 7, To: 11, Colour: FgMagenta})
  d.ColourLine(0, LineColour{From: 13, To: 16, Colour: FgCyan})

  d.AddTopComment(0, 8, "%s was specified.")
  d.ColourTopComment(0, 0, LineColour{From: 0, To: 3, Colour: FgGreen})

  d.AddBottomComment(0, 13, "But a %d value was passed")
  d.ColourBottomComment(0, 0, LineColour{From: 6, To: 8, Colour: FgRed})
  
  print(d.String())

yada yada TODO

FAQs

Last updated on 24 Oct 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc