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

Enhancement: Import-Module #14

Open
ALuckyGuy opened this issue Jan 14, 2013 · 3 comments
Open

Enhancement: Import-Module #14

ALuckyGuy opened this issue Jan 14, 2013 · 3 comments

Comments

@ALuckyGuy
Copy link
Contributor

The following code allows IMPORT to work with modules as well as .dot-sourced ps1 files.

slim.ps1 @ Line 197

    "import" {
        if ( [System.IO.Path]::GetExtension($ins[2]) -eq '.psm1' ) {
          import-module ".\$($ins[2])"
       } else {
          iex ". .\$($ins[2])"
       }
       "OK"; return
    }
@ALuckyGuy
Copy link
Contributor Author

I suppose I should have used iex "import module '.$($ins[2])' " to be consistent.

Is there another benefit to importing a module or dot sourcing a PS1 file that way though? Does it isolate errors in filenames better that way? I noticed when importing a .PS1 file I needed to preface my functions with script: our they weren't in scope. I'm guessing this is due to using invoke-expression though I haven't tried it w/o iex to confirm that.

@konstantinvlasenko
Copy link
Owner

I see. I can make this changes. Or you can use the standard GitHub fork + pull request technic :)

@konstantinvlasenko
Copy link
Owner

BTW: While the PowerSlim does his job, I don't like the current implementation. So improvements are welcome

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