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

Make Web5 CLI compatible with Windows (Bash/WSL and PowerShell) #386

Open
13 tasks
Tracked by #322
blackgirlbytes opened this issue Oct 9, 2024 · 0 comments
Open
13 tasks
Tracked by #322

Comments

@blackgirlbytes
Copy link
Contributor

Make Web5 CLI compatible with Windows (Bash/WSL and PowerShell)

🚀 Goal

Extend the Web5 Rust CLI to be fully functional on Windows, specifically in both Windows Bash (WSL) and PowerShell environments.

🔑 Tasks

General Windows Compatibility

  • Assess current Windows compatibility issues in the Web5 Rust CLI
  • Implement cross-platform file path handling
  • Update any Unix-specific system calls to be cross-platform
  • Implement Windows-specific error handling and messages
  • Create Windows-specific installation instructions
  • Update documentation to include Windows-specific information
  • Add Windows environments to the CI/CD pipeline for testing
  • Write tests covering Windows-specific functionality

Windows Bash (WSL) Specific

  • Ensure all CLI commands work correctly in Windows Bash (WSL)
  • Address any WSL-specific quirks or limitations

PowerShell Specific

  • Verify and adjust functionality for PowerShell
  • Handle Windows-specific permissions and UAC (User Account Control) if necessary
  • Implement any PowerShell-specific command syntax or output formatting

🌟 Resources

⚡ Getting Started

  1. Comment ".take" on this issue to get assigned
  2. Fork the repository and create a new branch for this task
  3. Set up a Windows development environment with both WSL and PowerShell for testing
  4. Start addressing the tasks, focusing on cross-platform compatibility
  5. Submit a pull request with your changes
  6. Respond to any feedback during the review process

Implementation Ideas

  1. Use the std::env::consts::OS to detect the operating system and adjust behavior accordingly.
  2. Utilize the std::path module for cross-platform file path handling.
  3. For Windows-specific functionality, consider using the winapi crate.
  4. Example of cross-platform path handling:
use std::path::PathBuf;

let path = if cfg!(windows) {
    PathBuf::from(r"C:\Users\Username\Documents")
} else {
    PathBuf::from("/home/username/documents")
};
  1. For commands requiring admin privileges on Windows, you might need to implement a UAC prompt:
#[cfg(windows)]
fn is_admin() -> bool {
    use winapi::um::securitybaseapi::IsUserAnAdmin;
    unsafe { IsUserAnAdmin() != 0 }
}

#[cfg(windows)]
fn require_admin() {
    if !is_admin() {
        println!("This command requires administrator privileges. Please run as administrator.");
        std::process::exit(1);
    }
}
  1. When testing, ensure to verify functionality in both Windows Bash (WSL) and PowerShell environments.

  2. Consider using conditional compilation with #[cfg(windows)] for Windows-specific code blocks.

💭 Questions?

If you have any questions or need clarification, please comment on this issue or join our Discord community.

Happy coding! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant