1
0
Fork
You've already forked opener
0

initial code #1

Merged
ninanomenon merged 9 commits from init into main 2025年07月27日 17:44:45 +02:00
ninanomenon commented 2025年07月22日 21:15:14 +02:00 (Migrated from github.com)
Copy link
No description provided.
sigmasternchen (Migrated from github.com) approved these changes 2025年07月23日 21:37:48 +02:00
sigmasternchen (Migrated from github.com) left a comment
Copy link

Just some notes, the rest looks fine.

Just some notes, the rest looks fine.
@ -0,0 +1,53 @@
///OpensatargetfileorURLusingtheappropriateplatform-specificopener.
sigmasternchen (Migrated from github.com) commented 2025年07月23日 21:32:40 +02:00
Copy link

I don't know why but somehow I don't like the variable assignment.

Unfortunately I don't know how to write it cleaner without introducing another function. Here is my idea, but I'm not sure whether it's better.

fn apply(func: fn(a: A) -> R, a: A) -> A {
 func(a)
}
pub fn open(target: String) {
 get_platform_opener() 
 |> opener_to_exec()
 |> apply([target])
}

It would be amazing to be able to capture the function as an argument like below. But this doesn't seem to work...

 |> _([target])
I don't know why but somehow I don't like the variable assignment. Unfortunately I don't know how to write it cleaner without introducing another function. Here is my idea, but I'm not sure whether it's better. ```suggestion fn apply(func: fn(a: A) -> R, a: A) -> A { func(a) } pub fn open(target: String) { get_platform_opener() |> opener_to_exec() |> apply([target]) } ``` It would be amazing to be able to capture the function as an argument like below. But this doesn't seem to work... ``` |> _([target]) ```
sigmasternchen (Migrated from github.com) commented 2025年07月23日 21:35:26 +02:00
Copy link

Just a note: Linux and Darwin are Kernels, but the Win32 Kernel would be NT.

Just a note: Linux and Darwin are Kernels, but the Win32 Kernel would be NT.
@ -0,0 +49,4 @@
{Port, {exit_status, Code}} ->
port_close(Port),
{error, {Code, list_to_binary(lists:reverse(Acc))}}
end.
sigmasternchen (Migrated from github.com) commented 2025年07月23日 21:37:17 +02:00
Copy link

This looks rather magic to me. Maybe a comment would be good here.

This looks rather magic to me. Maybe a comment would be good here.
sigmasternchen (Migrated from github.com) approved these changes 2025年07月24日 15:10:55 +02:00
ninanomenon (Migrated from github.com) reviewed 2025年07月27日 17:41:57 +02:00
@ -0,0 +1,53 @@
///OpensatargetfileorURLusingtheappropriateplatform-specificopener.
ninanomenon (Migrated from github.com) commented 2025年07月27日 17:41:57 +02:00
Copy link

fixed!

fixed!
ninanomenon (Migrated from github.com) reviewed 2025年07月27日 17:42:10 +02:00
@ -0,0 +49,4 @@
{Port, {exit_status, Code}} ->
port_close(Port),
{error, {Code, list_to_binary(lists:reverse(Acc))}}
end.
ninanomenon (Migrated from github.com) commented 2025年07月27日 17:42:09 +02:00
Copy link

I added a comment

I added a comment
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ninanonemon/opener!1
Reference in a new issue
ninanonemon/opener
No description provided.
Delete branch "init"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?