A library and CLI Utility to manage NVRAM Stuff, written in Swift.

Overview

NVRAMKit

A Library and CLI Utility to manage NVRAM Stuff, written in Swift.

Library

Adding Library to Project

Simply add this line to the dependencies section of your Package.swift file:

.package(url: "https://github.com/Serena-io/NVRAMKit.git", branch: "main")

Library Usage

Declare a new instance of the NVRAM Struct, for example:

let nvram = NVRAM()

Getting value of existing NVRAM Variable

Use NVRAM Class Subscript, Example:

let nvram = NVRAM()
// Returns the value of NVRAM variable "SystemAudioVolume"
let value = nvram["SystemAudioVolume"]
print(value ?? "Unknown Value")

Creating / Setting variables of NVRAM Variables

For creating a new NVRAM variable or setting the value of an existing NVRAM Variable, use the createOrSetOFVariable function. Note that this function throws. Example:

let nvram = NVRAM()
// Creates a new NVRAM Variable by the name of "exampleVariable" with value "example value"
let variableName = "exampleVariable"
let variableValue = "example value"
do {
  try nvram.createOrSetOFVariable(variableName: variableName, variableValue: variableValue)
} catch {
  print(error.localizedDescription)
}

Deleting an NVRAM Variable

Use the deleteOFVariable function to delete an NVRAM Variable. Example:

let nvram = NVRAM()
do {
  // Deletes NVRAM Variable by the name of "randomVariable"
  try nvram.deleteOFVariable(variableName: "randomVariable")
} catch {
  print(error.localizedDescription)
}

Syncing an NVRAM Variable

Use the syncOFVariable function to sync an NVRAM Variable. In the Parameters, you can specify force syncing the variable (though not recommended at all), Example:

let nvram = NVRAM()
do {
  // Syncs the NVRAM Variable "SystemAudioVolume"
  try nvram.syncOFVariable(variableName: SystemAudioVolume, forceSync: false)
} catch {
  print(error.localizedDescription)
}

Checking for existance of NVRAM Variable

Use the OFVariableExists function to return true or false based on whether or not an NVRAM Variable exists. Example:

let nvram = NVRAM()
// Returns true or false based on whether or not an NVRAM Variable by the name of "SystemAudioVolume" exists
let variableExists = nvram.OFVariableExists(variableName: "SystemAudioVolume")
print(variableExists)

Getting all NVRAM Variables and their values

Use getAllOFVariables, which returns a Dictionary of Variable names and values. Example:

let nvram = NVRAM() 
let allVariables = nvram.getAllOFVariables()
for (key, value) in allVariables {
  print("\(key): \(value ?? "Unknown Value")")
}

CLI Utility

The CLI Utility, going by the name NVRAMUtil, uses the NVRAMKit library to manage NVRAM Variables.

NVRAMUtil runs on both Jailbroken iOS and macOS Devices

Options

Formatting Options:

  • -j, --json Outputs specified NVRAM Variable(s) and their values in JSON Format
  • -x, --xml Outputs specified NVRAM Variable(s) and their values in XML Format

Listing Options:

  • -a, --all Prints all NVRAM Variables and their values
  • -l, --list Prints all NVRAM Variable names without their values

Managing individual NVRAM Variables:

  • -p, --print VARIABLE-TO-PRINT Prints a specified NVRAM Variable
  • -d, --delete VARIABLE-TO-DELETE Delete a specified NVRAM Variable
  • VARIABLE-NAME=VARIABLE-VALUE Set / Create a NVRAM Variable with a specified value
You might also like...
A silly CLI for replacing macosx.internal SDK settings in .xcodeproj files with macosx

fix-macos-internal-sdk A silly CLI for replacing macosx.internal SDK settings in .xcodeproj files with macosx.

CLI tool for macOS that transcribes speech from the microphone using Apple’s speech recognition API, SFSpeechRecognizer. (help.)
CLI tool for macOS that transcribes speech from the microphone using Apple’s speech recognition API, SFSpeechRecognizer. (help.)

CLI tool for macOS that uses SFSpeechRecognizer to transcribe speech from the microphone. The recognition result will be written to the standard output as JSON string.

Phiole - Allow to write or read from standards stream or files for script or CLI application

No longer maintained! Phiole - Φole Simple object to wrap three NSFileHandle: 'output', 'error' to write and 'input' to read There is of course a defa

A CLI to Alcatraz, the Xcode package manager.
A CLI to Alcatraz, the Xcode package manager.

Azkaban This project is deprecated in favor of Editor Extensions support in Xcode 8+. A CLI to Alcatraz, the Xcode package manager. Usage Install a pl

Command line utility to profile compilation time of Swift project.
Command line utility to profile compilation time of Swift project.

xcprofiler Command line utility to profile compilation time of Swift project. This tool is developed in working time for Cookpad. Installation gem ins

Command-line utility that checks comments for localizations in iOS interface files (.xib, .storyboard)

Localizations Comments Checker It's really easy to overlook and don't add comment for localization in interface file (.storyboard or .xib). This comma

Command line utility to create a list of installed iOS simulators, for use with SwiftUI previews.

Installed-simulators - Command line utility to create a list of installed iOS simulators, for use with SwiftUI previews.

Linenoise-Swift  A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement.
Linenoise-Swift A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement.

Linenoise-Swift A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement. Supports Mac OS and Linux Line edit

CommandLineKit - A pure Swift library for creating command-line interfaces

CommandLineKit A pure Swift library for creating command-line interfaces. Note: This project is no longer maintained. It's preserved here for historic

Releases(v1.0.2)
Owner
Serena
She / her. Writes code in Swift.
Serena
Swift-Misc-Utility - Taking the misc out of General Utility so that General only defines the namespace

Swift-Misc-Utility Everything extra that used to be in Swift-General-Utility has

Erica Sadun 4 Feb 4, 2022
A cli program written in swift (with async/await) that removes the unnecessary parts of xcframeworks.

xctrim A cli program written in swift (with async/await) that removes the unnecessary parts of xcframeworks. Usecase Say you downloaded firebase sdk a

Mustafa Yusuf 32 Jul 18, 2022
Guaka - Smart and beautiful POSIX compliant CLI framework for Swift.

Guaka - Smart and beautiful POSIX compliant CLI framework for Swift. It helps you create modern and familiar CLI apps in the vein of widely used proje

Omar Abdelhafith 1.1k Dec 24, 2022
Swift-cli - Example of building command-line tools in Swift

swift-cli Example of building command-line tools in Swift Step 1: Create CLI wit

Noah Gift 2 Jan 17, 2022
An extremely simple CLI tool that was created to diagnose and further understand an issue in DriverKit causing kIOHIDOptionsTypeSeizeDevice to behave incorrectly when used in DriverKit system extensions.

IOKitHIDKeyboardTester This tool is NOT useful to, or intended for general users. IOKitHIDKeyboardTester is an extremely simple (one-file!) CLI tool t

Karen/あけみ 6 Jul 22, 2022
A CLI too powered by Swift to provision environments using an up.toml manifest file

tuist-up tuist up was originally a Tuist built-in command to provision environments by reading the requirements in a manifest file Setup.swift. Althou

Tuist 5 Mar 31, 2022
A starting point to create CLI utilities with swift

cli tuist template A starting point to create CLI utilities with swift Installation Just create a Tuist folder and a Templates folder inside it. Creat

humdrum 6 May 3, 2022
A Tuist Template to quickly create CLI apps in Swift

macOS CLI Template Motivation I'm writing more and more Swift CLI apps these days. And as I solve more problems with this litte tools, I find that I'm

Diego Freniche 21 Dec 28, 2022
Snpm - Snippet Manager CLI With Swift

Snippet Manager CLI Usage foo@bar:~$ snpm --help OVERVIEW: Utill for searching s

Gleb Zavyalov 5 Jan 5, 2023
ConcurrentTest - Swift macOS CLI example on how to NOT do concurrent coding

Swift Concurrent Test Open the .xcodeproj file in Xcode, and try running it seve

Thisura Dodangoda 0 Jan 21, 2022