Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:46
    marcgoff commented #17367
  • 13:57
    matt9ucci commented #17078
  • 13:54
    jhoneill commented #17408
  • 13:22
    pull-request-quantifier[bot] commented #17402
  • 13:22
    pull-request-quantifier[bot] commented #17402
  • 13:22
    github-actions[bot] synchronize #17402
  • 13:22

    github-actions[bot] on dotnet_update

    Update .NET SDK version from `7… (compare)

  • 13:22
    github-actions[bot] edited #17402
  • 12:55
    doctordns commented #17408
  • 12:49
    pull-request-quantifier[bot] commented #17078
  • 12:49
    pull-request-quantifier[bot] commented #17078
  • 12:49
    matt9ucci synchronize #17078
  • 12:09
    LaurentDardenne commented #8823
  • 11:59
    pull-request-quantifier[bot] commented #16951
  • 11:59
    pull-request-quantifier[bot] commented #16951
  • 11:59
    MartinGC94 synchronize #16951
  • 10:00
    jhoneill commented #17408
  • 09:35
    Dellroc commented #2996
  • 09:34
    doctordns commented #17408
  • 09:03
    AE1020 commented #1908
Mochtar van de Griendt
@Aprazeth
So if I understand you correctly, the perl program spits out the data in format "...[number]" or "[number...]", or possible "[number]" ? Also, feel free to DM me directly here (just in case anyone gets a bit miffed at our constant chatting ;) )
Will Pittenger
@will_pittenger:matrix.org
[m]
No. I'm calling them. They have parameters like --playlist-start and --playlist-end.
Will Pittenger
@will_pittenger:matrix.org
[m]

@Aprazeth: They do have a --playlist-items. It's described as shown below:

Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: --playlist-items 1,2,5,8 if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: --playlist-items 1-3,7,10-13, it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13.

However, I'm not using that option as of now.
Mochtar van de Griendt
@Aprazeth
@will_pittenger:matrix.org what, I think I have been mistaken this whole time. Are you using the powershell script to call the perl program or the other way around?
Will Pittenger
@will_pittenger:matrix.org
[m]
I call them.
When my script is called, I translate each parameter into the perl program's counterpart.
But since a start should always be less than a end, I'm trying to ensure that if both are specified, the start is less than the end.
Will Pittenger
@will_pittenger:matrix.org
[m]
@Aprazeth: ??? You still here?
Mochtar van de Griendt
@Aprazeth
Yeah I am. Anyway, I'd go with the option that @wgross suggested earlier. Probably the easiest to implement and get working
Had a few things to do here - hence
Will Pittenger
@will_pittenger:matrix.org
[m]
I'm writing a PowerShell module with C#. How do I detect that an optional parameter wasn't specified. Can I access $PSBoundParameters? Do I put ? on the parameter type? In this case, the optional parameter is an enum.
Mochtar van de Griendt
@Aprazeth
@will_pittenger:matrix.org Is that optional paremeter required by any chance in specific scenario? Say for example that an user uses paramater -From which then would require paramter -To to also be specified. If that's the case, you can perhaps use Parametersets
Mochtar van de Griendt
@Aprazeth
Also, there is a community discord for PowerShell at https://aka.ms/psdiscord - which might be a lot more active
Will Pittenger
@will_pittenger:matrix.org
[m]
@Aprazeth: I needed to derive from PSCmdLet rather than CmdLet. That provides access to the MyInvocations member which has BoundParameters.
Couleur
@couleurm
hi, just testing the bridge
wait why isn't it in #bridge on Discord
Sanam
@sanamhub
I've automated many tasks using PowerShell which were on my head.. Is there any resource where there is the list of "Tasks to automate via PowerShell"?
1 reply
zw5
@zw5
a
Will Pittenger
@will_pittenger:matrix.org
[m]
I was reading how yt-dlp has manpages available. That got me wondering if Powershell supports them or anything similar for components that don't directly support Powershell. We're talking about programs that come as EXE files.
Will Pittenger
@will_pittenger:matrix.org
[m]
It also would be nice if EXE files could provide auto-complete information for their command line options. Note that with many programs ported from *nix, -axi is equivalent to -a -x -i. That would be an obstacle.
Then would PowerShell need to know when to translate -x into /x for older DOS programs.
I would suggest having a field in the auto-complete information file describing which is needed. You then default it one way or the other so it can be anticipated what to do if the file omits that field.
As for the previously mentioned MAN documentation, that supports something that Powershell's system doesn't: Color.
Will Pittenger
@will_pittenger:matrix.org
[m]
I've been going through Create a Crescendo cmdlet - PowerShell | Microsoft Docs. Unfortunately, there's a problem with the samples is that a parameter might be optional in one parameter set, but mandatory in another.
Will Pittenger
@will_pittenger:matrix.org
[m]
In my case, I'm working on a cmdlet where several parameters can be specified, but you must specify at least one.
No mention is made of the Position option for the ParameterAttribute.
Will Pittenger
@will_pittenger:matrix.org
[m]
Well, I created PowerShell/Crescendo#132.
Will Pittenger
@will_pittenger:matrix.org
[m]
Also, can a parameter be one of several types? For instance, if the parameter is a URL, I like to accept either a System.URI or a string. For a folder, I like to take either a System.IO.Directory or a string.
4 replies
HRXN
@Hrxn
Are the PowerShell community extensions (Pscx) still actively developed? Does anyone know?
JamesLear92
@JamesLear92
Hi guys, I raised a feature request issue ~2 years ago, and the thread is pretty dead. I've just realised that the issue doesn't have a "Needs Triage" label, and I can't see any way to add the label myself.
Is there anyone here who can add labels to issues?
PowerShell/PowerShell#12047
Will Pittenger
@will_pittenger:matrix.org
[m]
Weird. On Windows 11 Pro, PowerShell 7.2.4 thinks it's running on Windows 10.0.22000.
Will Pittenger
@will_pittenger:matrix.org
[m]
So '' would be invalid as would c:\.
If I'm expecting a System.Guid, I don't want them passing 4. Plus, this way, I'm not converting objects to/and from string as much.
Will Pittenger
@will_pittenger:matrix.org
[m]
Crescendo needs a documentation site for the schema. It should provide details on each field and samples. For instance, a page should be present describing the HandlerType and Handler members of a OutputHandler member. What do those values mean? A few random blog posts don't count. It would appear that HandlerType can only have one of several values. So list them and describe each. Then describe how that affects how Handler is interpreted.
1 reply
Will Pittenger
@will_pittenger:matrix.org
[m]
Can a PowerShell class declare events?
Doesn't look like it.
will_pittenger
@will_pittenger:matrix.org
[m]
If I have a string with an unknown number of whitespace characters at the start, is there a handy way to determine how many?
will_pittenger
@will_pittenger:matrix.org
[m]
Well, I wrote a class method:
    hidden [int]GetIndentLevel()
    {
        $this.CurLine -match '^(?<Indent>\s*';
        return $Matches.Indent -split '(  |\t)';
    }
Will Pittenger
@will_pittenger:matrix.org
[m]
Are PowerShell classes passed by reference? I'm looking for the equivilent of the C# ref keyword so I can have a function I call make changes to a variable in my scope.
I see [ref], but that's a type by itself and ruins my type safety. I'd rather declare the parameter as ref [int] name and pass the variable with ref valueVar like I would with C#.
The documentation for [ref] also seems to suggest it's mainly for COM.
People still explicitly use COM?
So 1990s.
Will Pittenger
@will_pittenger:matrix.org
[m]
Well, based on this, that's a resounding no.
C:\Users\willp> function Test([string]$x){$x = '%'}
C:\Users\willp> $g = 'dgfd'
C:\Users\willp> Test($g)
C:\Users\willp> $g
dgfd
C:\Users\willp> function Test([ref]$x){$x = '%'}
C:\Users\willp> Test($g)
Test: Cannot process argument transformation on parameter 'x'. Reference type is expected in argument.
Neither option worked.
Will Pittenger
@will_pittenger:matrix.org
[m]
Well, I had the usage of [ref] wrong, but I'm still missing something.
C:\Users\willp> Test(([ref]$g))
C:\Users\willp> $g
dgfd
C:\Users\willp> function Test([string]$x){$x = '%'}
C:\Users\willp> Test(([ref]$g))
C:\Users\willp> $g
dgfd
Will Pittenger
@will_pittenger:matrix.org
[m]
I got it working, but I don't like the lack of type safety. I don't know why my C# PowerShell module won't load, but if I can figure it out, I'm scrapping this script and starting over in C#.
Probably would result in faster code.