-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dodano funkcję do wyświetlania kucyków używając ponysay Oryginalny ponysay wyświetlał błąd opisany w erkin/ponysay#314 Więc ponysay brany jest z https://github.com/Tonyl314/ponysay
- Loading branch information
Showing
10 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs"; | ||
customPonysay = { | ||
url = "github:Tonyl314/ponysay"; | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = | ||
{ nixpkgs, self }: | ||
{ nixpkgs, customPonysay, self }: | ||
let | ||
pkgs = nixpkgs.legacyPackages.x86_64-linux; | ||
libs = import ./nix/libs.nix { inherit pkgs customPonysay; }; | ||
in | ||
{ | ||
devShells.x86_64-linux.default = (import ./nix/shell.nix) { inherit pkgs; }; | ||
apps.x86_64-linux.default = (import ./nix/app.nix) { inherit pkgs; }; | ||
devShells.x86_64-linux.default = (import ./nix/shell.nix) { inherit pkgs libs; }; | ||
apps.x86_64-linux.default = (import ./nix/app.nix) { inherit pkgs libs; }; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
{ pkgs }: | ||
let | ||
libs = import ./libs.nix { inherit pkgs; }; | ||
in | ||
{ pkgs, libs }: | ||
pkgs.mkShell { | ||
nativeBuildInputs = libs.nativeBuildInputs; | ||
nativeBuildInputs = libs.nativeBuildInputs ++ libs.buildInputs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "ponysay.h" | ||
|
||
#include <iostream> | ||
|
||
#include "../util.h" | ||
|
||
void ponysay(const std::string& pony_name) { | ||
std::string cmd = "ponysay -o -f " + pony_name; | ||
std::cout << exec(cmd); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
void ponysay(const std::string& pony_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "util.h" | ||
|
||
#include <cstdio> | ||
#include <iostream> | ||
#include <memory> | ||
#include <stdexcept> | ||
#include <string> | ||
#include <array> | ||
|
||
std::string exec(const std::string& cmd) { | ||
std::array<char, 128> buffer; | ||
std::string result; | ||
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose); | ||
if (!pipe) { | ||
throw std::runtime_error("popen() failed!"); | ||
} | ||
while (fgets(buffer.data(), static_cast<int>(buffer.size()), pipe.get()) != nullptr) { | ||
result += buffer.data(); | ||
} | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
#include <string> | ||
|
||
// Run linux command and return the stdout | ||
std::string exec(const std::string& cmd); |