Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getListItem and getListItems don't work (properly) with variables #41

Closed
mikeogezi opened this issue Dec 14, 2023 · 1 comment
Closed

Comments

@mikeogezi
Copy link
Contributor

mikeogezi commented Dec 14, 2023

Describe the bug
Issue #22 still exists.

To Reproduce

@l = list("Device Name", "Device Hostname")
@index = 0
@name = getListItem(l, index)
@x = list("a", "b", "c")
@y = 1
@z = 3
getListItems(x, y, z)

Debug output

Parsing test.cherri...

Program panic :(

Please report this: https://github.com/electrikmilk/cherri/issues/new

###################
#   DEBUG PANIC   #
###################

### PARSING ###

Previous Character:
) 8:0

Current Character:
LF 8:0

Next Character:
a 8:0

Current Line:
alert(name)
## TOKENS ##
1 | {variable lis action {list [{text Device Name} {text Device Hostname}]}}
2 | {variable index number 0}

## DEFINITIONS ##
Name: test
Color: -1263359489
Glyph: 61440
Inputs: []
Outputs: []
Workflows: []
No Input: { []}
macOS Only: false
Mininum Version: 2106.0.3
iOS Version: 17.0

## VARIABLES ##
@lis = {list [{text Device Name} {text Device Hostname}]} (action)
@index = 0 (number)

## MENUS ##
map[]

## IMPORT QUESTIONS ##
map[]

### PLIST GEN ###

## UUIDS ##
map[]

### CUSTOM ACTIONS ###


### INCLUDES ###

## INCLUDED ##
[]

## INCLUDES MAP ##
[]

#############################################################

panic: strconv.ParseInt: parsing "index": invalid syntax

goroutine 1 [running]:
main.panicDebug({0x102f817b8, 0x140000a6810})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/main.go:317 +0x118
main.handle({0x102f817b8, 0x140000a6810})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/main.go:271 +0x178
main.incrementValue({0x102f59600?, 0x140000a2210?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/action.go:391 +0x54
main.scriptingActions.func50({0x140000c4480, 0x140000a6750?, 0x140000b0590?})
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/actions_std.go:3902 +0x38
main.checkAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/action.go:202 +0x7c
main.collectAction()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:1191 +0x270
main.collectValue(0x140000d97b0, 0x140001317c0, 0xa)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:308 +0x4e4
main.collectVariableValue(0x0, 0x140001317b0, 0x140001317c0, 0x140001317f0, 0x140001317e0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:242 +0x3c
main.collectVariable(0x0)
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:487 +0x6e8
main.parse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:147 +0x480
main.initParse()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/parser.go:49 +0x2f4
main.main()
        /Users/michaelogezi/go/pkg/mod/github.com/electrikmilk/cherri@v0.1.11-beta.0.20231213200623-feb0bb1d0ce1/main.go:75 +0x35c

Version Information (please complete the following information):

  • macOS version (run uname -a): Darwin Michaels-MacBook-Air.local 23.2.0 Darwin Kernel Version 23.2.0: Fri Oct 13 09:28:08 PDT 2023; root:xnu-10002.60.54~14/RELEASE_ARM64_T8112 arm64
  • Golang version (run go version): go version go1.21.4 darwin/arm64

Originally posted by @mikeogezi in #22 (comment)

@electrikmilk
Copy link
Owner

We were trying to increment variable values, again this comes at the disadvantage of counting starting from 1, but this is just a fact of Shortcuts, perhaps this should be removed to accept that reality in the future. This is fixed by 9fa86bc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants