Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

dos2unix for powershell

License

NotificationsYou must be signed in to change notification settings

tagbug/ps-dos2unix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

Smart line ending converter with advanced encoding support for PowerShell

English |中文文档

Features ✨

  • 🎯 Smart encoding detection (BOM-aware)
  • 📁 Recursive directory processing
  • ⚡ Automatic .gitignore integration (requires Git)
  • 🛡️ Binary file protection mechanism
  • 🔄 On-the-fly encoding conversion (UTF-8/16/32)
  • 📏 Configurable file size limit (default 1MB)
  • 📝 File type whitelist/blacklist system

Installation 💻

Quick Install

irm https://raw.githubusercontent.com/tagbug/ps-dos2unix/main/install/install.ps1| iex

Manual Install

# 1. Clone the repositorygit clone https://github.com/tagbug/ps-dos2unix.git# 2. Create user module directory$documentsPath= [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)$userModulePath=Join-Path$documentsPath"WindowsPowerShell\Modules\dos2unix"New-Item-Path$userModulePath-ItemType Directory-Force# 3. Copy module filesCopy-Item ./ps-dos2unix/src/*$userModulePath-Recurse# 4. Verify installationImport-Module dos2unix-Forcedos2unix-Help

Note: If you encounter installation issues, try switching the line ending of the source code to CRLF.

Uninstall

Uninstall for quick install:

irm https://raw.githubusercontent.com/tagbug/ps-dos2unix/main/install/uninstall.ps1| iex

Uninstall for manual install:

# 1. Remove module directory$documentsPath= [Environment]::GetFolderPath([Environment+SpecialFolder]::MyDocuments)$userModulePath=Join-Path$documentsPath"WindowsPowerShell\Modules\dos2unix"Remove-Item$userModulePath-Recurse-Force# 2. Clean up environment variables$newPath= ($env:PSModulePath-split';'|Where-Object {$_-notmatch"dos2unix" })-join';'[Environment]::SetEnvironmentVariable("PSModulePath",$newPath,"User")# 3. Remove cloned repository (optional)Remove-Item ./dos2unix-Recurse-Force

Usage Example 🚀

Basic Conversion:

# Convert current directorydos2unix# Specify path with verbose outputdos2unix-Path D:\Projects-Verbose

Advanced Usage:

# Convert with encoding to UTF-8dos2unix-Path ./src-ConvertEncoding-TargetEncoding utf-8# Exclude directoriesdos2unix-Exclude node_modules,bin# Process large filesdos2unix-MaxFileSize10MB# Custom file filteringdos2unix-WhiteList"cs,json"-BlackList"exe,dll"

Configuration Options 🛠️

ParameterDescriptionDefault
-PathTarget directory pathCurrent directory
-ExcludeDirectories to excludenode_modules, dist, .git
-EncodingForce specific encodingAuto-detect
-WhiteListAllowed file extensionsCommon text formats
-BlackListBlocked file extensionsCommon binary formats
-MaxFileSizeMax file size (supports KB/MB/GB)1MB
-ConvertEncodingEnable encoding conversion$false
-TargetEncodingTarget encoding formatutf-8

FAQ 🤔

Q: File encoding issues after conversion?Backup files before processing!→ Try specifying encoding format:-Encoding utf8→ Check original file encoding:Get-Content -Encoding Byte -TotalCount 3

Q: Slow processing speed?→ Add excluded directories:-Exclude node_modules
→ Adjust file size limit:-MaxFileSize 500KB

License 📄

This project is licensed under theMIT License

About

dos2unix for powershell

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp