-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.cppsh
More file actions
33 lines (25 loc) · 797 Bytes
/
test.cppsh
File metadata and controls
33 lines (25 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env cppsh
// This script requires Boost.
// It creates a new folder called "Goose" in the current directory,
// then creates a text.txt file with placeholder text in it.
// Grab Boost
@package Boost COMPONENTS filesystem system REQUIRED
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem
// Work out paths
fs::path testDir = "Goose"
fs::path testFile = testDir / "test.txt"
// Ensure path exists!
fs::create_directory(testDir)
// Open file for writing
FileOut out(testFile.string())
out << "Hello, scripty world!"
// For the hell of it, a function!
auto PrintNum = func (Int inInt, OutputStream &os) -> void {
os << "Number " << inInt << Newl
}
for (Int i = 0; i < 20; i++) {
PrintNum(i, Out)
}
// Simple inline bash to demonstrate it working
`echo done!`