Page not found :(
The page you are looking for doesn't exist or has been moved.
diff --git a/content/docs/advmake/build-files.md b/content/docs/advmake/build-files.md index 8f7ae36..011985c 100644 --- a/content/docs/advmake/build-files.md +++ b/content/docs/advmake/build-files.md @@ -471,4 +471,6 @@ The fmt module exposes all the text functions from the golang fmt package except ```python fmt.Sprintf("Print %s string", "formatted") # "Print formatted string" -``` \ No newline at end of file +``` + +{{< button text="Godoc" bgcolor="#00ACD7" fgcolor="white" icon="cib:go" link="https://pkg.go.dev/fmt" >}} \ No newline at end of file diff --git a/functions/hi-from-lambda.js b/functions/hi-from-lambda.js new file mode 100644 index 0000000..194e04e --- /dev/null +++ b/functions/hi-from-lambda.js @@ -0,0 +1 @@ +!function(e,t){for(var n in t)e[n]=t[n]}(exports,function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t){t.handler=(e,t,n)=>{n(null,{statusCode:200,headers:{"Content-Type":"application/json"},body:JSON.stringify({message:"Hi from Lambda."})})}}])); \ No newline at end of file diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..fca2fa4 --- /dev/null +++ b/public/404.html @@ -0,0 +1,4 @@ +
The page you are looking for doesn't exist or has been moved.
AdvMake uses Starlark as the format for its build files. +Modules are also defined for both convenience and extra functionality.
Starlark is a Python-like language meant for configuration files.
Build files are by default called AdvMakefile
, but that can be set via -f
An AdvMakefile example can be found at AdvMake’s repo as it uses AdvMake itself.
AdvMake runs functions exposed by starlark in the format <name>_<target>
.
+To set the default name and target, the global variables defaultName
, and defaultTarget
must be set.
+Here is an example from AdvMake’s AdvMakefile:
defaultName = "advmake"
+defaultTarget = "build"
+
This will tell AdvMake to run the function advmake_build()
when run with no arguments.
If AdvMake is run with one argument (such as advmake install
), it will use the default name with the specified target,
+so in that case, it would run advmake_install()
.
If run with two arguments, AdvMake will use the first argument as the name and the second as the target.
+So, running advmake hello world
would run the function hello_world()
.
As previously mentioned, AdvMake comes with modules. Those are as follows:
runtime
The runtime module exposes some of golang’s runtime methods and variables.
runtime.GOOS
Stores a string denoting the operating system being used.
+Godocruntime.GOARCH
Stores a string denoting the CPU architecture being used.
+Godocruntime.NumCPU()
Get the number of logical CPUs available to the current process
+Godocruntime.GOMAXPROCS()
Definition: runtime.GOMAXPROCS(n)
Get or set the value of the GOMAXPROCS environment variable. This variable controls the maximum number of CPUs that can execute. This function will set GOMAXPROCS to n and then return the previous value. If n<1
, this function will not set the variable and will instead return the current setting
encoding
The strings module contains functions for encoding and decoding various formats. This module contains submodules for the various formats
Available submodules:
Json
Yaml
Toml
Hex
encoding.<Submodule>.Load()
Load a string formatted as the submodule format into a dictionary or string.
Examples:
x = encoding.Json.Load('{"encoding": "json"}')
+# x["encoding"] == "json"
+y = encoding.Hex.Load('546573740a')
+# y == "Test"
+
encoding.<Submodule>.Dump()
Dump a string formatted as the submodule format from a dictionary or string
Examples:
xDict = {"encoding": {"type": "toml"}}
+x = encoding.Toml.Dump(xDict)
+# x == '''
+#
+# [encoding]
+# type = "toml"
+#
+# '''
+y = encoding.Hex.Dump("Test")
+# y = "546573740a"
+
file
The file module contains functions for manipulation and checking of files
file.Expand()
Definition: file.Expand(file, mappings)
Expand any instances of $VAR
in a file according to provided mappings.
Examples:
file.txt
before:
I am running on $OS and architecture $arch
+
Code:
file.Expand("file.txt", {"OS": runtime.GOOS, "arch": runtime.GOARCH})
+
file.txt
after:
I am running on linux and architecture x86_64
+
file.Exists()
Definition: file.Exists(filepath)
Check whether a file exists
Example:
file.Exists("/etc/fstab") # True
+
file.Content()
Definition: file.Content(filepath)
Returns contents of a file as a string
Example:
file.txt:
This is a file
+
Code:
file.Content("file.txt") # "This is a file"
+
strings
The strings module contains functions for the manipulation of strings
strings.Regex()
Definition: strings.Regex(string, pattern, regex)
Parse a string using a regular expression and return the result in the specified format.
Examples:
x = strings.Regex("Hello, World", "$2, $1", "(.+), (.+)")
+# x == "World, Hello"
+y = strings.Regex("Hello, World", "$y, $x", "(?P<x>.+), (?P<y>.+)")
+# y == "World, Hello"
+z = strings.Regex("Hello, World", "$match, $2, $1", "(.+), (.+)")
+# z == "Hello, World, World, Hello"
+
strings.HasSuffix()
Definition: strings.HasSuffix(string, suffix)
Check whether a string ends with a suffix.
Examples:
strings.HasSuffix("doc.pdf", ".pdf") # True
+strings.HasSuffix("doc.pdf", ".md") # False
+
strings.HasPrefix()
Definition: strings.HasPrefix(string, prefix)
Check whether a string starts with a prefix.
Example:
strings.HasPrefix("doc.pdf", "doc") # True
+
strings.TrimSuffix()
Definition: strings.HasSuffix(string, suffix)
Remove suffix from string if it exists. If it does not exist, the string is returned unchanged.
Example:
strings.TrimSuffix("doc.pdf", ".pdf") # "doc"
+
strings.TrimPrefix()
Definition: strings.TrimPrefix(string, prefix)
Remove prefix from string if it exists. If it does not exist, the string is returned unchanged.
Example:
strings.TrimPrefix("doc.pdf", "doc") # ".pdf"
+
strings.TrimSpace()
Definition: strings.TrimSpace(string)
Trim leading and trailing white space, as defined by Unicode
Example:
strings.TrimSpace(" Hi ") # "Hi"
+
input
The input module prompts the user for input
input.Prompt()
Definition: input.Prompt(prompt)
Print prompt and wait for input, returning on newline
Example:
input.Prompt("Enter number: ")
+
input.Choice()
Definition: input.Choice(prompt, choices)
Assign number to each choice and prompt user to choose one
Example:
input.Choice("Choose greeting", ["Hi", "Hello", "Good morning"])
+
The above example looks like this to the user:
[1] "Hi"
+[2] "Hello"
+[3] "Good Morning"
+Choose greeting:
+
When the user chooses a number, the function will return the associated string. So, if the user chooses 1, "Hi"
will be returned.
url
The url module contains functions for the manipulation of URLs
url.Parse()
Definition: url.Parse(urlString)
Parses a URL and returns its components
Example:
parsed = url.Parse("https://www.arsenm.dev/docs/advmake/build-files")
+# parsed.Scheme == "https"
+# parsed.Host == "www.arsenm.dev"
+# parsed.Path == "/docs/advmake/build-files"
+
shell
The shell module contains functions for accessing and utilizing the shell.
shell.Exec()
Definition: shell.Exec(command, output?, concurrent?)
Runs a command or script using sh -c
, sending the output to STDOUT
and returning it unless set otherwise. It can also be concurrent.
Examples:
Code:
x = shell.Exec("date +%r") # "12:00:00 AM"
+y = shell.Exec("date +%r", output='return') # "12:00:00 AM"
+z = shell.Exec("date +%r | base64", output='stdout') # None
+shell.Exec("""
+ sleep 1
+ sleep 2
+""", concurrent=True) # Sleeps for two seconds
+
STDOUT:
12:00:00 AM
+MTI6MDA6MDAgQU0K
+
shell.Getenv()
Definition: shell.Getenv(key)
Returns the value of an environment variable
Example:
shell.Getenv('TERM') # "xterm"
+
shell.Setenv()
Definition: shell.Setenv(key, value, onlyIfUnset?)
Sets the value of an environment variable. It can be configured not to set the value if it is already set
Examples:
shell.Setenv("X", "x") # $X = x
+shell.Setenv("CC", "gcc") # if $CC unset, $CC = gcc
+
shell.LookPath()
Definition: shell.LookPath(command)
Returns the path to the executable of the specified command. Returns -1
if the command is not found in PATH
.
Examples:
shell.LookPath('sh') # "/bin/sh"
+shell.LookPath('nonExistentCommand') # -1
+
net
The net module contains various network functions
net.Download()
Download a file from a URL, optionally specifying the filename. It will show progress if the Content-Length
header is present.
Examples:
net.Download("https://minio.arsenm.dev/advmake/0.0.1/advmake-linux-x86_64")
+net.Download("https://minio.arsenm.dev/advmake/0.0.1/advmake-linux-x86_64", filename="advmake")
+
log
The log module contains functions to log events at various levels
The available levels are:
Info
Debug
Warn
Fatal
log.<Level>()
Definition: log.<Level>(message)
Logs a message at the specified level. The fatal level quits after logging the message.
Examples:
log.Info("Test log")
+log.Fatal("Error")
+
fmt
The fmt module exposes all the text functions from the golang fmt package except for all the Fprint
and Fscan
functions.
fmt.Sprintf("Print %s string", "formatted") # "Print formatted string"
+
⇐ Docs
AdvMake is hosted on my Gitea instance. If that is down, it is also mirrored on Gitlab.
To download AdvMake, you can either use the download button on Gitea or Gitlab, or +you can use the git CLI
To clone AdvMake using the CLI, run one of the following commands:
git clone https://gitea.arsenm.dev/Arsen6331/advmake.git
+OR
+git clone https://gitlab.com/moussaelianarsen/advmake.git
+
AdvMake is written in Go. This means go must be installed on your computer. Most
+linux distros call the package that provides it either go
or golang
.
Once go is installed, you can check that it runs by running
go version
+
To compile AdvMake, run
go build
+
To install AdvMake, run:
sudo install -Dm755 advmake /usr/bin
+
Once the command completes, AdvMake should be ready and you can run the following to make sure it works:
advmake -h
+
This page assumes you have already installed Opensend. If not, follow the installation +instructions on the installation page.
InstallationOpensend GUI has been written in golang using fyne. Its source code can be found here:
Opensend GUITo download Opensend GUI, run the following command
git clone https://gitea.arsenm.dev/opensend/opensend-gui.git
+
To build Opensend GUI, go
must be installed. The process for that is explained in the installation instructions for Opensend. Once go
is installed, run:
go build
+
This may take a while as go
downloads and compiles Opensend GUI and Fyne.
Once the build is complete, there should be a file named opensend-gui
in the directory. Run this file to open the GUI which should look like this:
⇐ Docs
Opensend uses continuous integration to compile. You can find the binary by clicking the download binary badge above.
Opensend is hosted on Gitea.
To download opensend, you can either use the download button on one of the above, or +you can use the git command
To clone opensend using the command, run the following command:
git clone https://gitea.arsenm.dev/opensend/opensend.git
+
Now, you will want to cd
into the root of this repo before completing the rest
+of these instructions
Since Opensend is written in go, you will need go installed in order to compile it.
+Most linux distros call the package providing it either go
or golang
.
Once go is installed, you can check that it runs by running
go version
+
To compile Opensend, run the following command:
make
+
To install opensend, run one of the following commands:
sudo make install # Linux
+sudo make install-macos # macOS
+
Once this command completes, to test whether opensend was installed properly, run +this command:
opensend -h
+
You should get the usage for opensend.
This page assumes you have already installed Opensend. If not, follow the installation +instructions on the installation page.
InstallationOpensend allows configuration by TOML and by command line flags. It looks at the following paths for configs in the specified order:
--config
flag~/.config/opensend.toml
/etc/opensend.toml
Usage of opensend:
+ -d string
+ Data to send
+ -dest-dir string
+ Destination directory for files or dirs sent over opensend (default "/home/arsen/Downloads")
+ -r Receive data
+ -s Send data
+ -send-to string
+ Use IP address of receiver instead of mDNS
+ -skip-mdns
+ Skip zeroconf service registration (use if mdns fails)
+ -t string
+ Type of data being sent
+
The purpose of the mdns-skipping flags is to account for the iSH app in iOS, as the mdns resolver and registration fails on it.
Pak uses a custom config file at /etc/pak.cfg
. For example, this is what the
+apt config looks like:
# Write the name of the package manager in all lowercase below
+apt
+# Write a comma separated list of commands from the manager below
+install,remove,update,upgrade,search,download
+# Write "yes" or "no" depending on whether you want to use root
+yes
+# Write command to use for root
+sudo
+# Write a comma separated list of shortcuts below
+rm,inst
+# Write a comma separated list of shortcut mappings from the manager below
+remove,install
+
+
This file is read by pak to tell it what to do. The comments above each keyword +explain what it’s for.
Here is a list of all the fields and their uses:
sudo
, doas
, etc.)Once you have made the config, just place it at /etc/pak.cfg
and pak will
+automatically use it.
Pak uses continuous integration to compile. You can find the binary by clicking the download badge above.
If you are running an arch-based linux distro, you can use the Arch User Repository
+to install pak. First, make sure the yay
AUR helper is installed, then run the following:
yay -S pak
+
Pak is hosted on my Gitea instance. If that is down, it is also mirrored on Gitlab.
To download pak, you can either use the download button on Gitea or Gitlab, or +you can use the git CLI
To clone pak using the CLI, run one of the following commands:
git clone https://gitea.arsenm.dev/Arsen6331/pak
+OR
+git clone https://gitlab.com/moussaelianarsen/pak
+
Pak is written in Go. This means go must be installed on your computer. Most
+linux distros call the package that provides it either go
or golang
.
Once go is installed, you can check that it runs by running
go version
+
To compile pak, run
make
+
Then, you will need to figure out which package manager you have. Here is a list +of package managers with ready to use configs:
If your package manager is not in the list, you can make a config for it. Go to +the Configuration page for more information.
If your package manager is in the list, use one of these:
sudo make aptinstall
sudo make aptitude
sudo make brewinstall
sudo make yayinstall
sudo make pacinstall
sudo make zyppinstall
sudo make snapinstall
sudo make installbinonly
Once the command completes, unless you’re using a custom config, pak should be ready +and you can run the following to make sure it works:
pak
+
Go to the Configuration page for instructions on making a custom config, you must +have a config for pak to function.
Using pak is simple, just run pak
and one of the commands from the config file.
+Pak understands partial commands, so these commands will be identical:
pak in <package>
+OR
+pak inst <package>
+OR
+pak install <package>
+
The lack of sudo
is intentional. Pak will not allow running from root by default
+as it already invokes root internally. To bypass this, simply give pak the -r
flag.
Using shortcuts in pak is just as simple as commands, just run pak
and a shortcut,
+like this:
pak rm <package>
+