Renamed from cppscript to compilescript.
This commit is contained in:
parent
1b46b56624
commit
93e079cc89
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required (VERSION 3.2)
|
||||
project(cppscript
|
||||
project(compilescript
|
||||
VERSION 0.1.0
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
|
21
README.md
21
README.md
|
@ -1,20 +1,21 @@
|
|||
**cppscript** allows you to execute C++ files as scripts.
|
||||
**compilescript** allows you to execute files from compiled languages as
|
||||
scripts. By default it uses g++.
|
||||
|
||||
It compiles the source file, stores the binary in `${XDG_CACHE_HOME}/cppscript/`
|
||||
and executes it.
|
||||
It compiles the source file, stores the binary in
|
||||
`${XDG_CACHE_HOME}/compilescript/` and executes it.
|
||||
|
||||
It does compile the file every time at the moment.
|
||||
|
||||
## Usage
|
||||
|
||||
Use `#!/usr/bin/env cppscript` as shebang and write the compiler arguments in
|
||||
the line below with the prefix: `//cppscript:`
|
||||
Use `#!/usr/bin/env compilescript` as shebang and write the compiler arguments
|
||||
in the line below with the prefix: `//compilescript:`
|
||||
|
||||
### Example
|
||||
|
||||
```C++
|
||||
#!/usr/bin/env cppscript
|
||||
//cppscript: -Wall -pedantic -Wextra
|
||||
#!/usr/bin/env compilescript
|
||||
//compilescript: -Wall -pedantic -Wextra
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -29,13 +30,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
## Configuration
|
||||
|
||||
The configuration file is in `${XDG_CONFIG_HOME}/cppscript.cfg`.
|
||||
The configuration file is in `${XDG_CONFIG_HOME}/compilescript.cfg`.
|
||||
|
||||
### Example config
|
||||
|
||||
```CFG
|
||||
compiler = "g++";
|
||||
cache_dir = "/home/user/.cache/cppscript";
|
||||
cache_dir = "/home/user/.cache/compilescript";
|
||||
```
|
||||
|
||||
## Install
|
||||
|
@ -53,7 +54,7 @@ cache_dir = "/home/user/.cache/cppscript";
|
|||
#### Get sourcecode
|
||||
|
||||
Download the current
|
||||
[release](https://schlomp.space/tastytea/cppscript/releases) and copy
|
||||
[release](https://schlomp.space/tastytea/compilescript/releases) and copy
|
||||
[xdgcfg](https://schlomp.space/tastytea/xdgcfg) into `xdgcfg/`.
|
||||
|
||||
If you clone from git, be sure to `git submodule init` and
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -1,4 +1,4 @@
|
|||
/* This file is part of cppscript.
|
||||
/* This file is part of compilescript.
|
||||
* Copyright © 2018 tastytea <tastytea@tastytea.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
@ -44,7 +44,7 @@ fs::path cache_dir;
|
|||
void read_settings()
|
||||
{
|
||||
bool need_save = false;
|
||||
xdgcfg config("cppscript.cfg");
|
||||
xdgcfg config("compilescript.cfg");
|
||||
if (config.read() != 0)
|
||||
{
|
||||
config.write();
|
||||
|
@ -70,7 +70,7 @@ void read_settings()
|
|||
xdgHandle xdg;
|
||||
xdgInitHandle(&xdg);
|
||||
cache_dir = xdgCacheHome(&xdg);
|
||||
cache_dir /= "cppscript";
|
||||
cache_dir /= "compilescript";
|
||||
xdgWipeHandle(&xdg);
|
||||
}
|
||||
if (!fs::is_directory(cache_dir))
|
||||
|
@ -104,9 +104,9 @@ int main(int argc, char *argv[])
|
|||
string buf;
|
||||
std::getline(in, buf);
|
||||
std::getline(in, buf);
|
||||
if (buf.substr(0, 12).compare("//cppscript:") == 0)
|
||||
if (buf.substr(0, 16).compare("//compilescript:") == 0)
|
||||
{
|
||||
compiler_arguments = buf.substr(12);
|
||||
compiler_arguments = buf.substr(16);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Reference in New Issue