Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

Commit

Permalink
Add: Time, Date and Version for Read[]
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatgec committed Aug 22, 2020
1 parent 034c161 commit 4c8dba2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Binary file modified fla
Binary file not shown.
8 changes: 8 additions & 0 deletions flascript/Interpreter/Read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <sstream>
#include <fstream>
#include <iostream>
#include <FlaVersion.hpp>
#include <Tokenizer.hpp>
#include <Interpreter/Interpreter.hpp>
#include <Interpreter/Read.hpp>
Expand Down Expand Up @@ -56,6 +57,13 @@ FRead::Read(std::string arg) {
std::cout << info.getKernel();
} else if(assign == "terminal") {
std::cout << info.getTerm();
} else if(assign == "time") {
std::cout << __TIME__;
} else if(assign == "date") {
std::cout << __DATE__;
} else if(assign == "version") {
FlaVersion ver;
std::cout << ver.VersionAlgorithm() << "\n";
} else {
assign = getenv(assign.c_str());
std::cout << assign;
Expand Down
8 changes: 8 additions & 0 deletions stdlib/info/SystemInfo.flsh
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ func -> GetTerminal() {
func -> GetDesktopEnv() {
read(string&) -> type[XDG_CURRENT_DESKTOP]
}

func -> GetTime() {
read(string&) -> type[time]
}

func -> GetDate() {
read(string&) -> type[date]
}
5 changes: 4 additions & 1 deletion test.fls
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import(<info/SystemInfo.flsh>) -> time <-
main() -> main {
fprintln(<%string>[:"Hello":, :"FlaScript!":, :"1234567890":])
print(string) -> "Time: "
put[time -> func -> GetTime() <-]
print(newline)
}

0 comments on commit 4c8dba2

Please sign in to comment.