public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Shell feature?
@ 2020-02-10 20:11 Andrew Fish
  2020-02-11 20:28 ` [edk2-devel] " Tim Lewis
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Fish @ 2020-02-10 20:11 UTC (permalink / raw)
  To: devel@edk2.groups.io

I wanted to start a conversation on the mailing list prior to writing up a BZ, to make sure I'm not missing anything, or in case there is a better way to implement this. 

I was thinking it would be good to have a Shell API that lets you associate a file type with an internal or external shell command. The Idea would be to pre-pend the internal/external shell command to the file name and also pass the arguments.

So this:
fs0:>dump.py 1  2 3

Becomes:
fs0:>python3.efi dump.py 1  2 3

Basically you just need an API like:

ShellAddScriptingLanguage (L".py", L"python3.efi");

Seems like this could just plug into the Shell via a ShellExecute(). So for example you could make Python a UEFI Shell command via a library and that library constructor could also teach the shell that a .py file could be an executable?

Thanks,

Andrew Fish

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
  2020-02-10 20:11 Shell feature? Andrew Fish
@ 2020-02-11 20:28 ` Tim Lewis
  2020-02-11 21:30   ` Jim Dailey
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Lewis @ 2020-02-11 20:28 UTC (permalink / raw)
  To: devel, afish

Andrew --

I think this is a good idea, but I think this is probably a shell spec issue
because I don't want competing, incompatible implementations.  

A few other issues: I think there is a persistence issue (similar to shell
variables) so that the change could be installed and survive a reboot. I
also think there can be a simple shell command that manages extensions (so
that they can be installed by a script)

Tim

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew Fish
via Groups.Io
Sent: Monday, February 10, 2020 12:12 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] Shell feature?

I wanted to start a conversation on the mailing list prior to writing up a
BZ, to make sure I'm not missing anything, or in case there is a better way
to implement this. 

I was thinking it would be good to have a Shell API that lets you associate
a file type with an internal or external shell command. The Idea would be to
pre-pend the internal/external shell command to the file name and also pass
the arguments.

So this:
fs0:>dump.py 1  2 3

Becomes:
fs0:>python3.efi dump.py 1  2 3

Basically you just need an API like:

ShellAddScriptingLanguage (L".py", L"python3.efi");

Seems like this could just plug into the Shell via a ShellExecute(). So for
example you could make Python a UEFI Shell command via a library and that
library constructor could also teach the shell that a .py file could be an
executable?

Thanks,

Andrew Fish




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
  2020-02-11 20:28 ` [edk2-devel] " Tim Lewis
@ 2020-02-11 21:30   ` Jim Dailey
  2020-02-12  1:30     ` Carsey, Jaben
       [not found]     ` <8A8C80EA-FDD7-4AF6-896C-7A7263446D62@apple.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Jim Dailey @ 2020-02-11 21:30 UTC (permalink / raw)
  To: devel; +Cc: tim.lewis, afish

Andrew,

Granted such a feature would be nice, but it seems like it might be a
fair amount of trouble just to avoid typing "python3", which could be
aliased to something as short a "p".

Jim

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim Lewis
Sent: Tuesday, February 11, 2020 2:28 PM
To: devel@edk2.groups.io; afish@apple.com
Subject: Re: [edk2-devel] Shell feature?


[EXTERNAL EMAIL] 

Andrew --

I think this is a good idea, but I think this is probably a shell spec issue
because I don't want competing, incompatible implementations.

A few other issues: I think there is a persistence issue (similar to shell
variables) so that the change could be installed and survive a reboot. I
also think there can be a simple shell command that manages extensions (so
that they can be installed by a script)

Tim

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew Fish
via Groups.Io
Sent: Monday, February 10, 2020 12:12 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] Shell feature?

I wanted to start a conversation on the mailing list prior to writing up a
BZ, to make sure I'm not missing anything, or in case there is a better way
to implement this. 

I was thinking it would be good to have a Shell API that lets you associate
a file type with an internal or external shell command. The Idea would be to
pre-pend the internal/external shell command to the file name and also pass
the arguments.

So this:
fs0:>dump.py 1  2 3

Becomes:
fs0:>python3.efi dump.py 1  2 3

Basically you just need an API like:

ShellAddScriptingLanguage (L".py", L"python3.efi");

Seems like this could just plug into the Shell via a ShellExecute(). So for
example you could make Python a UEFI Shell command via a library and that
library constructor could also teach the shell that a .py file could be an
executable?

Thanks,

Andrew Fish







^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
  2020-02-11 21:30   ` Jim Dailey
@ 2020-02-12  1:30     ` Carsey, Jaben
  2020-02-12  2:08       ` Andrew Fish
       [not found]     ` <8A8C80EA-FDD7-4AF6-896C-7A7263446D62@apple.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Carsey, Jaben @ 2020-02-12  1:30 UTC (permalink / raw)
  To: devel@edk2.groups.io, jim.dailey@dell.com
  Cc: tim.lewis@insyde.com, afish@apple.com

Andrew

You can already add a command via a driver (including a driver's library). Check into the Dynamic Commands in the shell spec.

Associating a file type with a command, basically if the first thing on the command line is a file of that type, then prepend the command and re-process the line, is very doable. It's almost like the alias feature that already exists.

I do agree with Tim that we should do a spec update, but concurrent development of code and spec seems required to prevent re-doing the spec.

-Jaben

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jim
> Dailey
> Sent: Tuesday, February 11, 2020 1:31 PM
> To: devel@edk2.groups.io
> Cc: tim.lewis@insyde.com; afish@apple.com
> Subject: Re: [edk2-devel] Shell feature?
> 
> Andrew,
> 
> Granted such a feature would be nice, but it seems like it might be a fair
> amount of trouble just to avoid typing "python3", which could be aliased to
> something as short a "p".
> 
> Jim
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim
> Lewis
> Sent: Tuesday, February 11, 2020 2:28 PM
> To: devel@edk2.groups.io; afish@apple.com
> Subject: Re: [edk2-devel] Shell feature?
> 
> 
> [EXTERNAL EMAIL]
> 
> Andrew --
> 
> I think this is a good idea, but I think this is probably a shell spec issue
> because I don't want competing, incompatible implementations.
> 
> A few other issues: I think there is a persistence issue (similar to shell
> variables) so that the change could be installed and survive a reboot. I also
> think there can be a simple shell command that manages extensions (so that
> they can be installed by a script)
> 
> Tim
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew
> Fish via Groups.Io
> Sent: Monday, February 10, 2020 12:12 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] Shell feature?
> 
> I wanted to start a conversation on the mailing list prior to writing up a BZ, to
> make sure I'm not missing anything, or in case there is a better way to
> implement this.
> 
> I was thinking it would be good to have a Shell API that lets you associate a
> file type with an internal or external shell command. The Idea would be to
> pre-pend the internal/external shell command to the file name and also pass
> the arguments.
> 
> So this:
> fs0:>dump.py 1  2 3
> 
> Becomes:
> fs0:>python3.efi dump.py 1  2 3
> 
> Basically you just need an API like:
> 
> ShellAddScriptingLanguage (L".py", L"python3.efi");
> 
> Seems like this could just plug into the Shell via a ShellExecute(). So for
> example you could make Python a UEFI Shell command via a library and that
> library constructor could also teach the shell that a .py file could be an
> executable?
> 
> Thanks,
> 
> Andrew Fish
> 
> 
> 
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
  2020-02-12  1:30     ` Carsey, Jaben
@ 2020-02-12  2:08       ` Andrew Fish
  2020-02-12  6:04         ` Carsey, Jaben
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Fish @ 2020-02-12  2:08 UTC (permalink / raw)
  To: Carsey, Jaben
  Cc: devel@edk2.groups.io, jim.dailey@dell.com, tim.lewis@insyde.com

Jaben,

My example was confusing, but my use case was to put this code in a library that adds a command. So after I register the command I’d like to register the file type to be processed by it.

Making an alias for an external command could be a different feature?
> On Feb 11, 2020, at 5:30 PM, Carsey, Jaben <jaben.carsey@intel.com> wrote:
> 
> Andrew
> 
> You can already add a command via a driver (including a driver's library). Check into the Dynamic Commands in the shell spec.
> 
> Associating a file type with a command, basically if the first thing on the command line is a file of that type, then prepend the command and re-process the line, is very doable. It's almost like the alias feature that already exists.
> 
> I do agree with Tim that we should do a spec update, but concurrent development of code and spec seems required to prevent re-doing the spec.
> 
> -Jaben
> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jim
>> Dailey
>> Sent: Tuesday, February 11, 2020 1:31 PM
>> To: devel@edk2.groups.io
>> Cc: tim.lewis@insyde.com; afish@apple.com
>> Subject: Re: [edk2-devel] Shell feature?
>> 
>> Andrew,
>> 
>> Granted such a feature would be nice, but it seems like it might be a fair
>> amount of trouble just to avoid typing "python3", which could be aliased to
>> something as short a "p".
>> 
>> Jim
>> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim
>> Lewis
>> Sent: Tuesday, February 11, 2020 2:28 PM
>> To: devel@edk2.groups.io; afish@apple.com
>> Subject: Re: [edk2-devel] Shell feature?
>> 
>> 
>> [EXTERNAL EMAIL]
>> 
>> Andrew --
>> 
>> I think this is a good idea, but I think this is probably a shell spec issue
>> because I don't want competing, incompatible implementations.
>> 
>> A few other issues: I think there is a persistence issue (similar to shell
>> variables) so that the change could be installed and survive a reboot. I also
>> think there can be a simple shell command that manages extensions (so that
>> they can be installed by a script)
>> 
>> Tim
>> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew
>> Fish via Groups.Io
>> Sent: Monday, February 10, 2020 12:12 PM
>> To: devel@edk2.groups.io
>> Subject: [edk2-devel] Shell feature?
>> 
>> I wanted to start a conversation on the mailing list prior to writing up a BZ, to
>> make sure I'm not missing anything, or in case there is a better way to
>> implement this.
>> 
>> I was thinking it would be good to have a Shell API that lets you associate a
>> file type with an internal or external shell command. The Idea would be to
>> pre-pend the internal/external shell command to the file name and also pass
>> the arguments.
>> 
>> So this:
>> fs0:>dump.py 1  2 3
>> 
>> Becomes:
>> fs0:>python3.efi dump.py 1  2 3
>> 
>> Basically you just need an API like:
>> 
>> ShellAddScriptingLanguage (L".py", L"python3.efi");
>> 
>> Seems like this could just plug into the Shell via a ShellExecute(). So for
>> example you could make Python a UEFI Shell command via a library and that
>> library constructor could also teach the shell that a .py file could be an
>> executable?
>> 
>> Thanks,
>> 
>> Andrew Fish
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
  2020-02-12  2:08       ` Andrew Fish
@ 2020-02-12  6:04         ` Carsey, Jaben
  0 siblings, 0 replies; 7+ messages in thread
From: Carsey, Jaben @ 2020-02-12  6:04 UTC (permalink / raw)
  To: devel@edk2.groups.io, afish@apple.com
  Cc: jim.dailey@dell.com, tim.lewis@insyde.com

That makes sense. So really what we are missing is a method to associate a file with a command (required to support dynamic commands).

We could do that in lots of ways, but the first I think of is to add a new API in the ShellProtocol to perform this association.

Do we also need a shell command for a user to view/edit the file associations?

Do associations need to maintain over a reboot?

-Jaben





> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew
> Fish via Groups.Io
> Sent: Tuesday, February 11, 2020 6:08 PM
> To: Carsey, Jaben <jaben.carsey@intel.com>
> Cc: devel@edk2.groups.io; jim.dailey@dell.com; tim.lewis@insyde.com
> Subject: Re: [edk2-devel] Shell feature?
> 
> Jaben,
> 
> My example was confusing, but my use case was to put this code in a library
> that adds a command. So after I register the command I’d like to register the
> file type to be processed by it.
> 
> Making an alias for an external command could be a different feature?
> > On Feb 11, 2020, at 5:30 PM, Carsey, Jaben <jaben.carsey@intel.com>
> wrote:
> >
> > Andrew
> >
> > You can already add a command via a driver (including a driver's library).
> Check into the Dynamic Commands in the shell spec.
> >
> > Associating a file type with a command, basically if the first thing on the
> command line is a file of that type, then prepend the command and re-
> process the line, is very doable. It's almost like the alias feature that already
> exists.
> >
> > I do agree with Tim that we should do a spec update, but concurrent
> development of code and spec seems required to prevent re-doing the spec.
> >
> > -Jaben
> >
> >> -----Original Message-----
> >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jim
> >> Dailey
> >> Sent: Tuesday, February 11, 2020 1:31 PM
> >> To: devel@edk2.groups.io
> >> Cc: tim.lewis@insyde.com; afish@apple.com
> >> Subject: Re: [edk2-devel] Shell feature?
> >>
> >> Andrew,
> >>
> >> Granted such a feature would be nice, but it seems like it might be a
> >> fair amount of trouble just to avoid typing "python3", which could be
> >> aliased to something as short a "p".
> >>
> >> Jim
> >>
> >> -----Original Message-----
> >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tim
> >> Lewis
> >> Sent: Tuesday, February 11, 2020 2:28 PM
> >> To: devel@edk2.groups.io; afish@apple.com
> >> Subject: Re: [edk2-devel] Shell feature?
> >>
> >>
> >> [EXTERNAL EMAIL]
> >>
> >> Andrew --
> >>
> >> I think this is a good idea, but I think this is probably a shell
> >> spec issue because I don't want competing, incompatible
> implementations.
> >>
> >> A few other issues: I think there is a persistence issue (similar to
> >> shell
> >> variables) so that the change could be installed and survive a
> >> reboot. I also think there can be a simple shell command that manages
> >> extensions (so that they can be installed by a script)
> >>
> >> Tim
> >>
> >> -----Original Message-----
> >> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> Andrew
> >> Fish via Groups.Io
> >> Sent: Monday, February 10, 2020 12:12 PM
> >> To: devel@edk2.groups.io
> >> Subject: [edk2-devel] Shell feature?
> >>
> >> I wanted to start a conversation on the mailing list prior to writing
> >> up a BZ, to make sure I'm not missing anything, or in case there is a
> >> better way to implement this.
> >>
> >> I was thinking it would be good to have a Shell API that lets you
> >> associate a file type with an internal or external shell command. The
> >> Idea would be to pre-pend the internal/external shell command to the
> >> file name and also pass the arguments.
> >>
> >> So this:
> >> fs0:>dump.py 1  2 3
> >>
> >> Becomes:
> >> fs0:>python3.efi dump.py 1  2 3
> >>
> >> Basically you just need an API like:
> >>
> >> ShellAddScriptingLanguage (L".py", L"python3.efi");
> >>
> >> Seems like this could just plug into the Shell via a ShellExecute().
> >> So for example you could make Python a UEFI Shell command via a
> >> library and that library constructor could also teach the shell that
> >> a .py file could be an executable?
> >>
> >> Thanks,
> >>
> >> Andrew Fish
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] Shell feature?
       [not found]     ` <8A8C80EA-FDD7-4AF6-896C-7A7263446D62@apple.com>
@ 2020-02-15  1:30       ` Andrew Fish
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Fish @ 2020-02-15  1:30 UTC (permalink / raw)
  To: devel, jim.dailey; +Cc: tim.lewis

[-- Attachment #1: Type: text/plain, Size: 3204 bytes --]

Jim,

Sorry I forgot to hit send on this....

We have scripts that run under OS and the EFI Shell that we use for debugging. So like Python in the OS you can just type the name of the script and it works, so folks expect the same behavior at the EFI shell :). 

Also as I mentioned in our case the interpreter was built into the shell. In that case you don't have pathing issues to launch Python. It is a lot easier to just distribute the UEFI Shell binary vs. forcing folks to have a bunch of files in specific directories to get things to work. 

Maybe we should futz around with the UEFI Python and wrap it in a lib so it can optionally get built into the UEFI Shell binary. 

Thanks,

Andrew Fish

> On Feb 11, 2020, at 1:54 PM, Andrew Fish <afish@apple.com> wrote:
> 
> 
> 
>> On Feb 11, 2020, at 1:30 PM, Jim Dailey <jim.dailey@dell.com> wrote:
>> 
>> Andrew,
>> 
>> Granted such a feature would be nice, but it seems like it might be a
>> fair amount of trouble just to avoid typing "python3", which could be
>> aliased to something as short a "p".
>> 
>> Jim
>> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io>> On Behalf Of Tim Lewis
>> Sent: Tuesday, February 11, 2020 2:28 PM
>> To: devel@edk2.groups.io <mailto:devel@edk2.groups.io>; afish@apple.com <mailto:afish@apple.com>
>> Subject: Re: [edk2-devel] Shell feature?
>> 
>> 
>> [EXTERNAL EMAIL] 
>> 
>> Andrew --
>> 
>> I think this is a good idea, but I think this is probably a shell spec issue
>> because I don't want competing, incompatible implementations.
>> 
>> A few other issues: I think there is a persistence issue (similar to shell
>> variables) so that the change could be installed and survive a reboot. I
>> also think there can be a simple shell command that manages extensions (so
>> that they can be installed by a script)
>> 
>> Tim
>> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Andrew Fish
>> via Groups.Io
>> Sent: Monday, February 10, 2020 12:12 PM
>> To: devel@edk2.groups.io
>> Subject: [edk2-devel] Shell feature?
>> 
>> I wanted to start a conversation on the mailing list prior to writing up a
>> BZ, to make sure I'm not missing anything, or in case there is a better way
>> to implement this. 
>> 
>> I was thinking it would be good to have a Shell API that lets you associate
>> a file type with an internal or external shell command. The Idea would be to
>> pre-pend the internal/external shell command to the file name and also pass
>> the arguments.
>> 
>> So this:
>> fs0:>dump.py 1  2 3
>> 
>> Becomes:
>> fs0:>python3.efi dump.py 1  2 3
>> 
>> Basically you just need an API like:
>> 
>> ShellAddScriptingLanguage (L".py", L"python3.efi");
>> 
>> Seems like this could just plug into the Shell via a ShellExecute(). So for
>> example you could make Python a UEFI Shell command via a library and that
>> library constructor could also teach the shell that a .py file could be an
>> executable?
>> 
>> Thanks,
>> 
>> Andrew Fish
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 


[-- Attachment #2: Type: text/html, Size: 47753 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-15  1:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-10 20:11 Shell feature? Andrew Fish
2020-02-11 20:28 ` [edk2-devel] " Tim Lewis
2020-02-11 21:30   ` Jim Dailey
2020-02-12  1:30     ` Carsey, Jaben
2020-02-12  2:08       ` Andrew Fish
2020-02-12  6:04         ` Carsey, Jaben
     [not found]     ` <8A8C80EA-FDD7-4AF6-896C-7A7263446D62@apple.com>
2020-02-15  1:30       ` Andrew Fish

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox