Skip to content

Commit

Permalink
Merge pull request #62 from brysgo-forks/master
Browse files Browse the repository at this point in the history
Add android as platform (termux)
  • Loading branch information
xavi- committed May 26, 2023
2 parents 9897be1 + 3f65ec1 commit b8da6f8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ switch(process.platform) {
case "openbsd":
config = require("./platform/openbsd");
break;
case "android":
config = require("./platform/android");
break;
default:
throw new Error("Unknown platform: '" + process.platform + "'. Send this error to xavi.rmz@gmail.com.");
}
Expand Down
9 changes: 9 additions & 0 deletions platform/android.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
exports.copy = { command: "termux-clipboard-set", args: [] };
exports.paste = { command: "termux-clipboard-get", args: [] };
exports.paste.full_command = exports.paste.command;
exports.encode = function(str) { return new Buffer(str, "utf8"); };
exports.decode = function(chunks) {
if(!Array.isArray(chunks)) { chunks = [ chunks ]; }

return Buffer.concat(chunks).toString("utf8");
};

0 comments on commit b8da6f8

Please sign in to comment.