You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cpgc/index.js

38 lines
1.1 KiB
JavaScript

const { platform, EOL } = require('os');
const { execSync } = require('child_process');
5 years ago
const fs = require('fs');
const path = require('path');
const { app, BrowserWindow } = require('electron');
const ipc = require('electron').ipcMain;
5 years ago
function createWindow() {
5 years ago
let win = new BrowserWindow({
5 years ago
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
});
win.loadFile('html/index.html');
5 years ago
// win.webContents.openDevTools()
win.webContents.on('did-finish-load', () => {
win.webContents.send('send_username', name);
win.webContents.send('send_useremail', email);
win.webContents.send('send_remote', remote);
win.webContents.send('send_status', status);
win.webContents.send('send_log', log);
win.webContents.send('send_branch', branch);
});
5 years ago
}
app.on('ready', createWindow);
5 years ago
let user = execSync("git config --list").toString().split(EOL);
let email = user[0].split('=')[1];
let name = user[1].split('=')[1];
let remote = user[6].split('=')[1];
let status = execSync("git status").toString();
let log = execSync("git log").toString();
let branch = execSync("git branch | grep \* | cut -d ' ' -f2").toString();