diff --git a/.gitignore b/.gitignore index d3aa067..683ed08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -cslt-tool +arduino-cslt .vscode lib* \ No newline at end of file diff --git a/README.md b/README.md index b3788bc..096f545 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,23 @@ -# cslt-tool +# arduino-cslt -`cslt-tool` is a convenient wrapper of [arduino-cli](https://github.com/arduino/arduino-cli), it compiles Arduino sketches outputting a precompiled library in the current working directory. +`arduino-cslt` is a convenient wrapper of [arduino-cli](https://github.com/arduino/arduino-cli), it compiles Arduino sketches outputting a precompiled library in the current working directory. It generates a json file in the `extras/` folder that contains information regarding libraries and core to use in order to build the sketch. The result is achieved by parsing the verbose output of `arduino-cli` and by using [GNU ar](https://sourceware.org/binutils/docs/binutils/ar.html) to generate an archive of the object files. ## Prequisites -In order to run this tool you have to install first the [Arduino CLI](https://github.com/arduino/arduino-cli) and have `arduino-cli` binary in your `$PATH`, otherwise `cslt-tool` won't work. +In order to run this tool you have to install first the [Arduino CLI](https://github.com/arduino/arduino-cli) and have `arduino-cli` binary in your `$PATH`, otherwise `arduino-cslt` won't work. Please use a version of the Arduino CLI that has [this](https://github.com/arduino/arduino-cli/pull/1608) change (version > 0.20.2). Another requirement is [`gcc-ar`](https://sourceware.org/binutils/docs/binutils/ar.html) (installable with `apt-get install gcc`) in your `$PATH`. ## Build it -In order to build `cslt-tool` just use `go build` +In order to build `arduino-cslt` just use `go build` ## Usage -`./cslt-tool compile -b ` +`./arduino-cslt compile -b ` [![asciicast](https://asciinema.org/a/463342.svg)](https://asciinema.org/a/463342) -For example, running `./cslt-tool compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino` should produce a library with the following structure, in the current working directory: +For example, running `./arduino-cslt compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino` should produce a library with the following structure, in the current working directory: ``` libsketch/ ├── examples @@ -34,7 +34,7 @@ libsketch/ This is an example execution: ``` -$ ./cslt-tool compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino +$ ./arduino-cslt compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino INFO[0000] arduino-cli version: git-snapshot INFO[0000] GNU ar (GNU Binutils) 2.37 INFO[0000] the ino file path is sketch/sketch.ino @@ -90,7 +90,7 @@ After completing that operation you can compile it with: `arduino-cli compile -b /examples/sketch/sketch.ino --library `. -It's important to use the `--library` flag to include the precompiled library generated with cslt-tool otherwise the Arduino CLI won't find it. +It's important to use the `--library` flag to include the precompiled library generated with arduino-cslt otherwise the Arduino CLI won't find it. For example a legit execution looks like this: ``` diff --git a/cmd/compile.go b/cmd/compile.go index 195082b..0adfc70 100644 --- a/cmd/compile.go +++ b/cmd/compile.go @@ -123,7 +123,7 @@ func compileSketch(cmd *cobra.Command, args []string) { // remove main.cpp file, we don't need it anymore removeMainCpp(inoPath) - // restore the sketch content, this allows us to rerun cslt-tool if we want without breaking the compile process + // restore the sketch content, this allows us to rerun arduino-cslt if we want without breaking the compile process createFile(inoPath, string(oldSketchContent)) logrus.Infof("restored %s", inoPath.String()) @@ -227,7 +227,7 @@ _loop(); } // removeMainCpp function, as the name suggests. will remove a main.cpp file inside inoPath -// we do this after the compile has been completed, this way we can rerun cslt-tool again. +// we do this after the compile has been completed, this way we can rerun arduino-cslt again. // If we do not remove this file and run the compile again it will fail because a main.cpp file with the same definitions is already present func removeMainCpp(inoPath *paths.Path) { mainCppPath := inoPath.Parent().Join("main.cpp") @@ -316,7 +316,7 @@ author=TODO maintainer=TODO sentence=This technically is not a library but a precompiled sketch. The result is produced using ` + os.Args[0] + ` paragraph= -url=https://github.com/arduino/cslt-tool +url=https://github.com/arduino/arduino-cslt version=1.0.0 precompiled=true` diff --git a/cmd/root.go b/cmd/root.go index 9747ce6..1a38331 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,8 +12,8 @@ import ( // rootCmd represents the base command when called without any subcommands var rootCmd = &cobra.Command{ - Use: "cslt-tool", - Short: "cslt-tool is a command-line tool that uses the Arduino CLI to generate objectfiles and a json file with info regarding core and libraries used", + Use: "arduino-cslt", + Short: "arduino-cslt is a command-line tool that uses the Arduino CLI to generate objectfiles and a json file with info regarding core and libraries used", } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/go.mod b/go.mod index ed72797..1d8192e 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module cslt-tool +module arduino-cslt go 1.17 diff --git a/main.go b/main.go index 5a1bd2c..88dd42d 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,7 @@ Copyright © 2021 NAME HERE */ package main -import "cslt-tool/cmd" +import "arduino-cslt/cmd" func main() { cmd.Execute()