V1 with working cmdline interface for easy of using GIT

This commit is contained in:
s41r4j
2025-08-08 16:27:43 +05:30
commit 71a398820a
2845 changed files with 396687 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import execa from 'execa';
const handler = error => {
if (error.code === 'ENOENT') {
throw new Error('Couldn\'t find the termux-api scripts. You can install them with: apt install termux-api');
}
throw error;
};
const clipboard = {
copy: async options => {
try {
await execa('termux-clipboard-set', options);
} catch (error) {
handler(error);
}
},
paste: async options => {
try {
const {stdout} = await execa('termux-clipboard-get', options);
return stdout;
} catch (error) {
handler(error);
}
},
copySync: options => {
try {
execa.sync('termux-clipboard-set', options);
} catch (error) {
handler(error);
}
},
pasteSync: options => {
try {
return execa.sync('termux-clipboard-get', options).stdout;
} catch (error) {
handler(error);
}
},
};
export default clipboard;