В Linux нельзя передавать более одного аргумента через строку shebang. Все аргументы будут переданы в виде одной строки в исполняемый файл:
#!/bin/foo -a -b -c
передаст одну опцию «-a -b -c» в /bin/foo
плюс содержимое файла. Например, если бы вы позвонили:
/bin/foo '-a -b -c' contents-of-file.txt
В наше время поведение должно быть одинаковым на большинстве производных Unix, но оно может отличаться, я не проверял их все:)
Трудно найти подходящую документацию для этого, лучшее, что я смог быстро найти, это: https://www.in-ulm.de/~mascheck/various/shebang/#splitting
[119 В качестве обходного пути вы обычно создаете оболочку оболочки:
#!/bin/bash
exec kotlin --arg1 --arg2 ... /path/to/kotlin-script
Here's my opinion, for what it's worth :
I don't really agree with the approach you suggest (except for the dumb view). In real life, you will often have to use an existing model : it could be legacy code that you don't have the time (or will) to change, or even a library for which you don't have the code. In my opinion, the model should be completely unaware of the way it will be displayed, and should be easily usable in a non-WPF application. So it doesn't have to implement any specific interface like INotifyPropertyChanged
of INotifyCollectionChanged
to make it usable in MVVM. I think that all the logic related to UI should reside in the ViewModel.
Regarding RoutedEvents
and RoutedCommands
, they are not really suitable for use with the MVVM pattern. I usually try to use as little RoutedEvents
as possible, and no RoutedCommands
at all. Instead, my ViewModels expose RelayCommand
properties that I bind to the UI in XAML (see this article by Josh Smith for details on RelayCommand
). When I really need to handle events for some control, I use attached behaviors to map the events to ViewModel commands (have a look at Marlon Grech's implementation)
So, in summary :
Of course it's just my approach, and it may not be the best, but I feel quite comfortable with it ;)