jsonfile

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package jsonfile is for interacting with a JSON file on disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONFile

type JSONFile struct {
	FilePath string
	Contents map[string]interface{}
}

JSONFile representation of a json file.

func LoadFromDisk

func LoadFromDisk(filePath string) JSONFile

LoadFromDisk loads the config.json from disk.

func (*JSONFile) Clear

func (j *JSONFile) Clear()

Clear the contents of the file, setting it to an empty json object.

func (JSONFile) EnsureExists

func (j JSONFile) EnsureExists()

EnsureExists makes sure the file exists on disk, will be empty json if created.

func (JSONFile) FileName

func (j JSONFile) FileName() string

FileName the file name extracted from the full path.

func (JSONFile) PrettyPrint

func (j JSONFile) PrettyPrint()

PrettyPrint outputs the current config as a pretty string.

func (JSONFile) String

func (j JSONFile) String() string

String current content as a string.

func (JSONFile) WriteToDisk

func (j JSONFile) WriteToDisk()

WriteToDisk writers the config to disk.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL