Skip to content
This repository was archived by the owner on Jan 27, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions kimai2-cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,24 @@ function kimaiServerTime(settings) {
* Interactive ui: select a project and activity and starts it
*
* @param {object} settings All settings read from ini
* @param {string} defaultProject The name of a project. If set, skips the project selection and goes directly to the activity selection.
*/
function uiKimaiStart(settings) {
function uiKimaiStart(settings, defaultProject) {
return new Promise((resolve, reject) => {
const selected = {}
kimaiList(settings, 'projects', false)
.then(res => {
return uiAutocompleteSelect(res[1], 'Select project')
if (!defaultProject) {
return uiAutocompleteSelect(res[1], 'Select project').then((res) => res.id)
} else {
return findId(settings, defaultProject, 'projects').then((projectId) => projectId)
}
})
.then(res => {
selected.projectId = res.id
.then(projectId => {
selected.projectId = projectId
return kimaiList(settings, 'activities', false, {
filter: {
project: res.id
project: projectId
}
})
})
Expand Down Expand Up @@ -939,6 +944,11 @@ program.command('start [project] [activity]')
const selected = {}
checkSettings()
.then(settings => {
if (!project || !activity) {
uiKimaiStart(settings, project);
return;
}

findId(settings, project, 'projects')
.then(projectid => {
selected.projectId = projectid
Expand Down
2 changes: 1 addition & 1 deletion kimai2-innosetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A10BF7B2-6641-4B06-9C68-268B649FCE57}
AppName=kimai2-cmd
AppVersion=1.3.1
AppVersion=1.4.0
AppPublisher=infeeeee
AppPublisherURL=https://github.com/infeeeee/kimai2-cmd
AppSupportURL=https://github.com/infeeeee/kimai2-cmd
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kimai2-cmd",
"version": "1.3.1",
"version": "1.4.0",
"description": "Command line client for Kimai2",
"main": "kimai2-cmd.js",
"bin": {
Expand Down