-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjff.ps1
35 lines (31 loc) · 1.02 KB
/
jff.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
if ($args.Count -eq 1) {
# Se houver um argumento, usa esse valor como nome do arquivo
$file = $args[0]
# Verifica se o arquivo tem a extensão .md
if (-not ($file -like "*.md")) {
$string = "Arquivo $file com extensão não suportada"
Write-Output $string
Exit
}
}
else {
# Obtém a lista de arquivos .md no diretório atual
$arquivosMD = Get-ChildItem -Filter *.md
# Verifica a quantidade de arquivos .md
if ($arquivosMD.Count -eq 1) {
# Se houver apenas um arquivo .md, armazena seu nome na variável $file
$file = $arquivosMD[0].Name
}
elseif ($arquivosMD.Count -gt 1) {
Write-Output "Há mais de um arquivo .md no diretório"
Exit
}
else {
Write-Output "Nenhum arquivo .md encontrado no diretório"
Exit
}
}
# Constrói o caminho completo para o script Python
$scriptPath = Join-Path $PSScriptRoot "src\jff.py"
# Executa o programa Python com o nome do arquivo como argumento
python $scriptPath $file