Skip to content

Commit

Permalink
Merge pull request #2274 from headlamp-k8s/fix-typo
Browse files Browse the repository at this point in the history
app: Fix typos and typing issues
  • Loading branch information
illume authored Aug 28, 2024
2 parents 8c529cc + 9cadf3b commit c26c913
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions app/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { platform } from 'os';
import path from 'path';
import url from 'url';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import i18n from './i18next.config';
import { PluginManager } from './plugin-management';
import windowSize from './windowSize';
Expand Down Expand Up @@ -102,25 +103,27 @@ function addPathFromShellToEnvOnMac() {
}
addPathFromShellToEnvOnMac();

const args = yargs
.command('$0 [kubeconfig]', '', yargs => {
yargs
.option('headless', {
describe: 'Open Headlamp in the default web browser instead of its app window',
})
.option('disable-gpu', {
describe: 'Disable use of GPU. For people who may have buggy graphics drivers',
type: 'boolean',
})
.positional('kubeconfig', {
describe:
'Path to the kube config file (uses the default kube config location if not specified)',
type: 'string',
});
const args = yargs(hideBin(process.argv))
.options({
headless: {
describe: 'Open Headlamp in the default web browser instead of its app window',
type: 'boolean',
},
'disable-gpu': {
describe: 'Disable use of GPU. For people who may have buggy graphics drivers',
type: 'boolean',
},
})
.positional('kubeconfig', {
describe:
'Path to the kube config file (uses the default kube config location if not specified)',
type: 'string',
})
.help().argv;
const isHeadlessMode = args.headless;
let disableGPU = args['disable-gpu'];
.help()
.parseSync();

const isHeadlessMode = args.headless === true;
let disableGPU = args['disable-gpu'] === true;
const defaultPort = 4466;

const useExternalServer = process.env.EXTERNAL_SERVER || false;
Expand Down Expand Up @@ -458,7 +461,7 @@ function startServer(flags: string[] = []): ChildProcessWithoutNullStreams {
? path.resolve('../backend/headlamp-server')
: path.join(process.resourcesPath, './headlamp-server');

let serverArgs = [];
let serverArgs: string[] = [];
if (!!args.kubeconfig) {
serverArgs = serverArgs.concat(['--kubeconfig', args.kubeconfig]);
}
Expand Down Expand Up @@ -1065,7 +1068,7 @@ function startElecron() {
console.info('Plugins are loaded. Loading full menu.');
setMenu(mainWindow, currentMenu);

if (pathInfoDebug) {
if (pathInfoDebug && mainWindow) {
dialog.showMessageBoxSync(mainWindow, {
type: 'info',
title: 'Path debug info',
Expand Down Expand Up @@ -1250,7 +1253,7 @@ function startElecron() {
process.platform === 'linux' &&
['arm', 'arm64'].includes(process.arch)
) {
consolg.info(
console.info(
'Disabling GPU hardware acceleration. Reason: known graphical issues in Linux on ARM (use --disable-gpu=false to force it if needed).'
);
disableGPU = true;
Expand Down

0 comments on commit c26c913

Please sign in to comment.