Skip to content
kociumba edited this page Apr 27, 2024 · 17 revisions

Welcome to the Ktool wiki

This is where you can find any information about installing Ktool or using it. If you still have questions after reading this please feel free to reach out to me on Discord kociumba or on the ktool issue tracker.


Setup

Using the scoop install script (recommended)

A script to install Ktool through scoop is provided, to utilize it follow these steps:

  • make sure you have scoop installed by following the instructions on the scoop website

  • run scoop install https://raw.githubusercontent.com/kociumba/ktool/main/ktool.json (this is required as I haven't published the script to the official scoop bucket yet)

    • to update ktool, you will need to reinstall it using scoop uininstall ktool and then scoop install https://raw.githubusercontent.com/kociumba/ktool/main/ktool.json, this is required as I have not set up any automatic version tracking so far.
  • you can test the installation by running ktool -help

Manual installation

To compile the latest version:

  • Clone the latest release from the main branch.

  • Make sure you have the latest version of Go installed from the Go website.

    • Note that using historical builds with installers for Windows from releases is not recommended as they will most likely contain bugs that are fixed in the newest versions.
    • You will also need a C compiler like gcc from msys2 or cygwin the easiest way to achieve that is to do scoop install gcc installed.
  • After that, get all the dependencies with go get -d ./... and build the binary with go build -ldflags "-s -w".

Ktool is a CLI tool, so you will need to add it to your PATH or invoke it with the path to the binary.

On Windows, the easiest way to do this is to use PowerShell running as admin and executing: [Environment]::SetEnvironmentVariable("Path", $env:Path + ";path\to\ktool.exe", "Machine").

On Linux, you can use: export PATH=$PATH:/path/to/ktool.

Using the powershell installer

Caution

This custom powershell installer is kept only for the sake of completeness. I made it before I knew how to write scoop manifests, and it's not recommended to use it as scoop is just way more reliable and offers an actual way to uninstall Ktool.

The only prerequisite is to have Go, PowerShell and a C compiler like gcc installed.

To use it clone the repository and open the Installer.ps1 script

If opened in an elevated PowerShell window it will add the compiled binary to your PATH

After installing, restart your terminal for the env changes to take effect, to make sure everything worked try running ktool -help if ktool isn't recognized as a command please try manual installation

Using go run

Warning

This is the developer way of running it and is not recommended for normal users.

Since Go has an extremely fast compiler, you can use Ktool without building it by using the go run command every time you want to open Ktool this will be slower than having a precompiled binary and will leave debugging strings and artifacts in the Ktool you will be using.

Note

Since version 0.0.0.1 Ktool requires a C compiler to compile the binary.


Usage

To use Ktool, just run it with the path to the ktool binary. This will open a new terminal window with the Ktool interface.

From there navigate using the arrow keys, space and enter to select the options as desired.

Warning

As stated in the README this tool is due for a rewrite in the future. This will most likely introduce breaking feature changes.

Features available are:

  • sys info - disabled for now until I find a better way to do this
  • notes - allows for writing, reading and deleting basic notes system-wide
  • currency convert - converts between any 2 currencies using real time exchange rates
  • list from directory - this is just ls but it requires you to specify the directory you want to list from
  • open Kserver - open a basic file server pointing to a specified directory with an option to forward it through ngrok
  • open Ksorter - this is the Ksorter integration, more on that in Ksorter integration
  • funny - pull a random dad joke from icanhazdadjoke.com and displays it
  • pricer - this is basically the same thing as Pricer just rewritten in go
  • fibonacci - calculates the fibonacci sequence up to the specified number
  • time zone converter - not finished

Support for command line arguments

Every currently supported feature has a corresponding command line argument:

  • -notes
  • -currency or -currencyconvert
  • -ls or -listfromdirectory
  • -ksorter
  • -kserver
  • -funny
  • -pricer
  • -fibonacci

Note

Note that any features that normally loop back to the main menu will have that functionality disabled and will exit out of Ktool after executing.

Help on command line arguments can always be accessed by using the -help argument.


Ksorter integration

Ksorter which is my powershell file sorting utility is integrated with Ktool.

The usage is the same as the standalone version the only difference is that Ktool downloads it for you and executes it in the current working directory.

Short overview of Ksorter:

  • when executed it sorts all files in the current directory by extension
  • then all the files get sorted into corresponding folders based on their extension
  • additionally any .jfif files can be optionally renamed to .jpeg as those extensions are identical in functionality

Warning

Ksorter lives in a separate repository and gets downloaded automatically. This means that Ktool always uses the newest version of Ksorter.

This behavior might sometimes flag the program as a virus.


Bug reports and contributing

If you find a bug, please report it in the issue tracker using the bug report template.

To contribute, check out the look in issue tracker and look for ones marked as good first issue or enhancement.

Or alternatively, you can open a pull request and mark it accordingly with tags.